grunt-bust-my-cache0.2.2 • Public • Published
Bust static assets from the cache using date.now() along with the ability to target specific files.
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-bust-my-cache --save-dev
If the plugin has been installed correctly, running
grunt --help at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a
devDependency, which ensures that it will be installed whenever the
npm install command is run.
The "bustMyCache" task
Use the bustMyCache task for cache busting static files in your application. This allows them to be cached forever by the browser, just point the task towards any file that contains references to static assets.
In your project's Gruntfile, add a section named
bustMyCache to the data object passed into
Allow you to pass a path to a specific file to be cache busted, useful if you don't want to blow away the cache on all of your files.
If your assets are located in a different directory, make sure you set this to the correct base path.
Basic Asset Cache Busting
Basic Asset Cache Busting with different configs
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.
v2.0 - Rewrote plugin from ground up and setup new unit tests.