Cache-busting plugin(new support for custom rev-type compared with gulp-rev-append) for gulp.
npm install gulp-rev-suffixgulp-rev-suffix
hello, world! hello, world!
---
> gulp plugin for cache-busting files using query string suffix

installation
---
``
`
$ npm install gulp-rev-suffix --save-dev
`
how?
---
_gulpfile.js_
`
var rev = require('gulp-rev-suffix');
//default, using file-hash as suffixes
gulp.task('rev', function() {
gulp.src('./index.html')
.pipe(rev())
.pipe(gulp.dest('.'));
});
//custom, add new rev-types
gulp.task('rev', function() {
gulp.src('./index.html')
//rev(options) options:the array contains multiple custom rev-types
.pipe(rev([{type:'timestamp',value:()=>{return Date.now();}},{type:'version',value:()=>{return '1.6.0'}}]))
.pipe(gulp.dest('.'));
});
`
_terminal_
`
$ gulp rev
(?:href|src)="(.)[\?]rev=@@(.)[\"]
what?
---
The gulp-rev-suffix plugins allows for appending a query-string suffix to dependencies declared in html files defined using the following regex:
`
That's fancy talk for any stylesheet or script declarations that are declared in an html file such as the following:
`
gulp-rev-suffix
will turn into something similar as the following after running :
`
`
Tips:rev=@@hash(default rev-type),the original suffix defined in the HTML file will be replaced with the following priority:
`
`
@@any-custom-type(predefined) > @@hash(existing file) > original-suffix
`
why?
---
In order to meet the project requirements of the company,forked from bustardcelly/gulp-rev-append and modify it to support custom rev-value.
Tests
---
``
$ npm run test
License
---
Copyright (c) 2020 duanjianbo
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.