我有点卡住了——我想用我的清单文件中的散列版本替换图像文件名。
清单看起来像这样:
{
"icons": [
{
"src": "android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
我希望将这些图标 src 替换为如下所示的散列文件名:“android-chrome-192x192-b03df0131.png”
我的 gulp 文件应该是这样的:
const gutil = require('gulp-util');
module.exports = function (gulp, plugins) {
return function () {
const manifest = gulp.src('public/dist/rev-manifest.json');
return gulp.src(['public/dist/@(css|js)/**','public/dist/img/icon/**.json'])
.pipe(plugins.revReplace({replaceInExtentions: ['.json']}))
.pipe(plugins.revReplace({manifest: manifest}))
.pipe(gulp.dest('public/dist'));
};
};