Takes the version number from within a file and adds it to the filename. This is specifically useful for pipelines outputting JS or CSS files. Allows for versioning controlled by you, instead of a hash, allowing for the use of human understandable sequencing (such as semver).
eg: myjslibrary-2.1.0.min.js
How to Use
Install module.
npm i gulp-version-filename
Somewhere Within Your CSS/JS/etc File
/** * My File * @version 8.12.12 */
gulpfile.js
var filever = ; /** * Takes the version number and adds it to the filename */gulp;
gulp rename
You should now have
dist/newcssfile-8.12.12.css
Options
-
key
Pass to change the version variable tag within the file, defaults to 'version'
-
silent
Pass to suppress errors thrown if the version parameter is not found within a file.
gulp;