grunt-filerev editorconfig jscs travis-ci grunt npm

[DEPRECATED] File revving

3 years after

grunt-filerev Build Status

Static asset revisioning through file content hash

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide, as it explains how to create a gruntfile as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command:

$ npm install --save-dev grunt-filerev


This task will revision your files based on its contents. You should then set the files to expire far into the future for better caching and it will only update when it changes.


  filerev: {
    options: {
      algorithm: 'md5',
      length: 8
    images: {
      src: 'img/**/*.{jpg,jpeg,gif,png,webp}'



Type: string
Default: 'md5'

algorithm is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are 'sha1', 'md5', 'sha256', 'sha512', etc. On recent releases, openssl list-message-digest-algorithms will display the available digest algorithms.


Type: number
Default: 8

Number of characters of the file hash to prefix the file name with.

process(basename, name, extension)

Type: function
Default: null
Returns: string

Function to process the revised file name and return back the new file name.


Type: string

Basename of the file.


Type: string

Name with the revision suffixed.


Type: string

The file extension.


It will overwrite the src files if you don't specify a dest:

filerev: {
  images: {
    src: ['img1.png', 'img2.png'],
    dest: 'tmp'


The task keeps track of all files created and its sources in a summary that is exposed through the grunt.filerev.summary object. It can be used to replace references to the revved files or debugging purposes. The key of the object is the original filename, the value is the new revved path.

For a configuration like this

filerev: {
  images: {
    src: ['img1.png', 'img2.png'],
    dest: 'tmp'

the content grunt.filerev.summary could look like that:

  'img1.png': 'tmp/img1.59bcc3ad.png',
  'img2.png': 'tmp/img2.060b1aa6.png'

Source Maps

The task will ensure that any source map for .css or .js file is revisioned with the same revision as the source file.

For example, js/main.js revisioned to js/main.9d713a59.js will also have js/ revisioned to the same hash js/


BSD license and copyright Google

Related Repositories



[UNMAINTAINED] Replaces references to non-optimized scripts or stylesheets into ...



Record asset paths from grunt-filerev to a json file. ...



Grunt plugin for running Usemin on Jade files ...



Replace references to grunt-filerev files. ...

Top Contributors

sindresorhus sleeper kevva passy stephanebachelier nelsonpecora arthurvr callmevlad zenorocha eddiemonge geedew AurelioDeRosa eirslett revolunet ludow maheshm PavelVanecek murphybob cbas XhmikosR facboy hemanth jnewman


-   v2.3.1 zip tar
-   v2.3.0 zip tar
-   v2.2.0 zip tar
-   v2.1.2 zip tar
-   v2.1.1 zip tar
-   v2.1.0 zip tar
-   v2.0.0 zip tar
-   v1.1.0 zip tar
-   v1.0.0 zip tar
-   v0.2.1 zip tar
-   v0.2.0 zip tar
-   v0.1.2 zip tar
-   v0.1.0 zip tar