gulp-rev 生成的manifest默認為:
"index.css": "index.css?v=04aff97a7b",
為避免同名文件覆蓋版本號,對替換的路徑增加一級目錄,如下
"css/index.css": "css/index.css?v=04aff97a7b",
修改gulp-rev下index.js,
123行增加manifest傳入參數:
opts = objectAssign({
path: 'rev-manifest.json',
merge: false,
// Apply the default JSON transformer.
// The user can pass in his on transformer if he wants. The only requirement is that it should
// support 'parse' and 'stringify' methods.
transformer: JSON,
pwd_base: '' //增加一級目錄
}, opts, pth);
146行增加:
originalFile = opts.pwd_base + originalFile;
gulp文件配置增加目錄:
.pipe(rev.manifest({ pwd_base: 'css/' }))
