Grunt task for updating the changed resources's reference, to get cache bust.
It can also instantly update reference of one file which its content not changed by us, but changed by this task.
Task will print colored change log in console, for checking what modify the task has done.
It will only match the file name.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a
gruntfile.js 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-update-reference --save-dev
Once the plugin has been installed, it may be enabled inside your
gruntfile.js with this line:
Then, add and configure it to your Gruntfile.js:
grunt reference task:
log to "simple", the log will be like this:
$ grunt referenceRunning "reference:dist" taskRunning "newer:reference_core:dist__path_to" taskRunning "reference_core:dist__path_to" taskAssets: foo.jpgrefresh foo.jpg's reference in bar.cssrefresh bar.css's reference in index.htmlDone, without errors.
log to "all":
$ grunt referenceRunning "reference:dist" taskRunning "newer:reference_core:dist__path_to" taskRunning "reference_core:dist__path_to" taskAssets: foo.jpgScan changed files' reference in ./path_toin file bar.css replace:background:url("./foo.jpg");--->background:url("./foo.jpg?h=98e8485471");File bar.css instantly changed, rescan path.+ Scan changed files' reference in ./path_to+ in file index.html replace:+ <link href="./bar.css?v=2" rel="stylesheet" type="text/css" />+ --->+ <link href="./bar.css?h=98e8485471&v=2" rel="stylesheet" type="text/css" />Done, without errors.