gulp-asset-rev-hash
Keeps a file's hash in file's links to your assets. For automatic cache updating purpose. Fork from gulp-rev-hash
Install
npm install --save-dev gulp-asset-rev-hash
Examples
Default
var gulp = ;var rev = ; gulp;
Input:
<!-- start-hash --> <!--[if lte IE 9]> <link rel="stylesheet" href="/site-path/main.min.css"> <script src="/site-path/abc.js"></script> <![endif]--> <!-- end-hash --> <!-- start-hash --> <!-- end-hash --><!-- start-hash --><!-- end-hash -->
Output:
<!-- start-hash --> <!--[if lte IE 9]> <link rel="stylesheet" href="/site-path/main.min.css?h=545778e418d1317d"> <script src="/site-path/abc.js?h=0b0378d799c2b64e"></script> <![endif]--> <!-- end-hash --> <!-- start-hash --> <!-- end-hash --><!-- start-hash --><!-- end-hash -->
Custom options
option | type | default | example |
---|---|---|---|
assetsDir | string | public | - |
assetsGetter | function | null | function(filePath, filePathRex, assetsDir) {} |
hashLength | number | 32 | - |
hashArgName | string | hash | - |
removeTags | boolean | false | - |
usePale | boolean | false | - |