i'm stuck a little - i want to replace image file names with their hashed version inside my manifest file.
Manifest looks like this:
{
"icons": [
{
"src": "android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
I want those icon src to be replaced with the hashed filenames which looks like this: "android-chrome-192x192-b03df0131.png"
My gulp file which should do it looks like this:
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'));
};
};