grunt-asset-revisions
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "grunt-asset-revisions", | ||
"description": "Generate revisions of assets.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"author": "vanetix <matmcfarland@gmail.com>", | ||
@@ -6,0 +6,0 @@ "main": "Gruntfile.js", |
@@ -35,9 +35,25 @@ # grunt-asset-revisions [![Build Status](https://travis-ci.org/vanetix/grunt-asset-revisions.png?branch=master)](https://travis-ci.org/vanetix/grunt-asset-revisions) | ||
```javascript | ||
flatten: { | ||
flatten: true, | ||
src: ['path/to/assets/**'], | ||
dest: 'path/to/dest' | ||
revisions: { | ||
flatten: { | ||
flatten: true, | ||
src: ['path/to/assets/**'], | ||
dest: 'path/to/dest' | ||
} | ||
} | ||
``` | ||
**Manifest** | ||
```javascript | ||
revisions: { | ||
manifest: { | ||
options: { | ||
manifest: true | ||
}, | ||
src: ['path/to/assets/**'], | ||
dest: 'path/to/dest' | ||
} | ||
} | ||
``` | ||
**Rename** | ||
@@ -47,4 +63,6 @@ > original filenames will be renamed | ||
```javascript | ||
rename: { | ||
src: ['path/to/assets/**'] | ||
revisions: { | ||
rename: { | ||
src: ['path/to/assets/**'] | ||
} | ||
} | ||
@@ -51,0 +69,0 @@ ``` |
@@ -26,2 +26,10 @@ /* | ||
/** | ||
* Default options | ||
*/ | ||
var options = this.options({ | ||
manifest: false | ||
}); | ||
/** | ||
* Loop over all file arguments saving revisions in | ||
@@ -32,2 +40,3 @@ * directory `f.dest` | ||
this.files.forEach(function(f) { | ||
var assets = []; | ||
@@ -58,2 +67,3 @@ /** | ||
var r = revision(file); | ||
var map = {}; | ||
@@ -72,3 +82,10 @@ if(f.dest) { | ||
} | ||
map[file] = r; | ||
assets.push(map); | ||
}); | ||
if(options.manifest) { | ||
grunt.file.write(path.join(f.dest, 'manifest.json'), JSON.stringify(assets, null, ' ')); | ||
} | ||
}); | ||
@@ -75,0 +92,0 @@ }); |
6785
95
75