Open fujunchun opened 7 years ago
Give me , please, more information about this problem.
I got the same problem,my rev-manifest.json is like below:
{
"js/util/util.js": "js/util/util-17b72c16ec.js"
}
and I processd this file with gulp-rev-collector,like this:(I used gulp-load-plugins to load plugins)
gulp.task("rev", function () {
return gulp.src(`build/rev-manifest.json`)
.pipe($.revCollector({
replaceReved: true,
dirReplacements: {
'js': function (manifest_value) {
console.log(manifest_value)
return '//js.40017.cn/touch/hb/c/2/';
},
}
}))
.pipe(gulp.dest('build/')) // write manifest to build dir
})
but it does nothing, the rev-manifest.json is still what it looked like before, please help me,thank u~
I hope the result is :
{
"js/util/util.js": "//js.40017.cn/touch/hb/c/2//util/util-17b72c16ec.js"
}
Try to use:
dirReplacements: {
'': function (manifest_value) {
return '//js.40017.cn/touch/hb/c/2/' + manifest_value;
},
}
Or make manifest file, contains
{
"util/util.js": "util/util-17b72c16ec.js"
}
and task code:
gulp.task("rev", function () {
return gulp.src(`build/rev-manifest.json`)
.pipe($.revCollector({
replaceReved: true,
dirReplacements: {
'js': function (manifest_value) {
return '//js.40017.cn/touch/hb/c/2/js/' + manifest_value;
},
}
}))
.pipe(gulp.dest('build/')) // write manifest to build dir
})
Hi, I face the same issue. Here is my task's code :
gulp.task('revision', function () {
return gulp.src('web/manifest.json')
.pipe(revCollector({
replaceReved: true,
dirReplacements: {
'': function(manifest_value) {
manifest_value = 'build/assets/' + manifest_value;
console.log(manifest_value);
return manifest_value;
}
}
}))
.pipe( gulp.dest('web') );
});
I can see my console.log in the terminal output but the file manifest.json
keeps unchanged.
Am I using it wrong ?
Yes. gulp-rev-collector does not change manifest.json content. manifest.json is a config for changes in other, not *.json files.
Well, in your previous comment you've written :
gulp.task("rev", function () {
return gulp.src(`build/rev-manifest.json`)
.pipe($.revCollector({
replaceReved: true,
dirReplacements: {
'js': function (manifest_value) {
return '//js.40017.cn/touch/hb/c/2/js/' + manifest_value;
},
}
}))
.pipe(gulp.dest('build/')) // write manifest to build dir
})
.pipe(gulp.dest('build/')) // write manifest to build dir
I don't understand: does it write manifest or not ?
return gulp.src(['rev/*/.json', 'templates/*/.html'])
when I use dirReplacements option, it does not work.