grunt-static-cache-buster
Cache busts static files and updates their references
Getting Started
This plugin requires Grunt.
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, you may install this plugin with this command:
npm install grunt-static-cache-buster --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
The "static_cache_buster" task
Overview
In your project's Gruntfile, add a section named static_cache_buster
to the data object passed into grunt.initConfig()
.
grunt
Options
filesToUpdateReferences
Type: Array
Default value: []
An array containing the files whose references will be updated.
<!-- Turn this --> <!-- Into this -->
Usage Examples
Basic usage
In this example, the source files will be busted by calculating the md5 and appendig it to the name like: 'file-to-bust.js' into 'file-to-bust-79d310bfe9ba9930c28043700467788e.js'.
grunt
With filesToUpdateReferences Option
In this example, the sources files will be busted and the refences will be updated.
grunt
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.
Release History
v0.1.3 - 2015-10-05
- Reviewed the regex.
v0.1.2 - 2015-10-04
- Reviewed the regex to update the files references.
v0.1.1 - 2015-10-01
- Publish the busting task.
License
Copyright (c) 2015 valter santos matos. Licensed under the MIT license.
Credits
This plugin was inspired by grunt-cache-busting