gulp-rev 生成的manifest默认为:
代码语言:javascript复制"index.css": "index.css?v=04aff97a7b",
为避免同名文件覆盖版本号,对替换的路径增加一级目录,如下
代码语言:javascript复制"css/index.css": "css/index.css?v=04aff97a7b",
修改gulp-rev下index.js,
123行增加manifest传入参数:
代码语言:javascript复制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行增加:
代码语言:javascript复制originalFile = opts.pwd_base originalFile;
gulp文件配置增加目录:
代码语言:javascript复制.pipe(rev.manifest({ pwd_base: 'css/' }))