gulp rev manifest 添加目录前缀

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/' }))

  

上一篇:201521123053《Java程序设计》第十一周学习总结


下一篇:背影渐变shape写法