gulp-rev-mtime
Appends a file's modified UNIX timestamp to a file URL to cache assets
Install
npm install --save-dev gulp-rev-mtime
Examples
Default
This example will take the example.html
file and add rev tags to all files that are found in this file, with default options.
var gulp = ;var rev = ; gulp;
Input:
Output:
Custom options
This example will take the example.html
file and add rev tags to all files that are found in this file with the custom options provided.
var gulp = ;var rev = ; gulp;
Input:
Output:
API
rev(options)
options.cwd
Type: String
Default: ''
Acts as a working directory for your assets, if your assets are not located in the root folder of the opened file.
options.suffix
Type: String
Default: 'v'
The name of the query parameter for versioning. Example: <script src="def.js?v=1393321187000"></script>
options.fileTypes
Type: Array
Default: ['js', 'css']
You can choose which files to add version tags to. Use this option if you only want to add version tags to specific file types.
License
MIT © Thomas Tuts