Skip to content

klindenboom/grunt-hash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grunt-hash

Append a unique hash to the end of a filename for cache busting. For example:

examples/test1.js => examples/dist/test1.b93fd451.js

##Grunt 0.4

This task now depends on grunt 0.4.x. Please see the grunt 0.3 to 0.4 migration guide for more details.

If you are still using grunt 0.3, please install grunt-hash 0.1x

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-hash

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-hash');

Documentation

grunt.initConfig({
	hash: {
		src: 'examples/*.js',  //all your js that needs a hash appended to it
		basePath: 'static/', //base path of your src
        flatten: false, // wether or not to flatten the output - default is true
		mapping: 'examples/assets.json', //mapping file so your server can serve the right files
		dest: 'examples/dist/' //where the new files will be created
	}
});
grunt.loadNpmTasks('grunt-hash');

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

License

Copyright (c) 2012 Greg Allen
Licensed under the MIT license.

About

a grunt plugin for appending hashes to files for cache busting

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.6%
  • PHP 1.4%