Bust Require.js module file cache.
npm install grunt-bust-requirejs-cache> Bust Require.js module file cache.
~0.4.5If 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:
``shell`
npm install grunt-bust-requirejs-cache --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-bust-requirejs-cache');
This task will parse the require function in your html source file just like require(['jquery', 'app/page-main']) to get your module name jquery and app/page-main, and then add the file content check sum hash code after the original module name.
See more about cache bust.
to the data object passed into grunt.initConfig().`js
grunt.initConfig({
bust_requirejs_cache: {
default: {
options: {
appDir: 'dist',
ignorePatterns: ['jquery', 'rs-config']
},
files: [
{
expand: true,
cwd: 'dist',
src: 'page/*/.html',
dest: 'dist'
}
]
}
},
});
`$3
#### options.appDir
Type:
String
Default value: ''The base dir.
#### options.ignorePatterns
Type:
Array
Default value: []Patterns that the task not parse.
$3
#### Custom Options
In this example the task process files in tmp dir. The task parse all the html files in page dir but the jquery module.
`js
grunt.initConfig({
bust_requirejs_cache: {
options: {
ignorePatterns: ['jquery'],
appDir: 'tmp'
},
files: [
{
expand: true,
cwd: 'dist',
src: 'page/*/.html',
dest: 'dist'
}
]
},
});
`
` html
Hello world!

``