-
Notifications
You must be signed in to change notification settings - Fork 55
The rev task is a really simple one. Its role is to read the content of a given file, generate a hash and prepend that hash to the original filename.
rev: {
js: ['publish/js/*.js'],
css: ['publish/css/*.css'],
img: ['publish/img/*']
},From this configuration example, the rev task will iterate through each expanded files for js / css / img subtasks and generate a hash from their content and rename each file accordingly.
A scripts.js file will be renamed into something like
12345678.scripts.js. The hash will change only when the content
changes.
hash helper takes care of files revving, by renaming any files in the
given files pattern(s), with passed in options.
task.helper('hash', files, options);- files - String or Array of glob pattern
- options - (optional) An Hash object where:
- cwd - Base directory to work from, glob patterns are prepended to this path.
md5 helper is a basic wrapper around crypto.createHash, with given
algorithm and encoding. Both are optional and defaults to md5 and
hex values.
task.helper('md5', file, algorithm, encoding);» Home
» Tasks
» clean: Wipe the previous build dirs.
» mkdirs: Prepares the build dirs.
» concat: Concatenate files. (built-in)
» css: Concats, replaces @imports and minifies CSS files.
» min: Minify files using UglifyJS (built-in)
» rev: Automate the revving of assets and perform the hash rename
» usemin: Replaces references to non-minified scripts / stylesheets
» serve: Spawns up a basic local http server
» connect: livereload version of serve task