欢迎光临
我们一直在努力

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/' }))
赞(0)
版权归原作者所有,如有侵权请告知。达维营-前端网 » gulp rev manifest 添加目录前缀

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址