Closed YDSS closed 8 years ago
HI, I'm using gulp-rev-collector and found it not working. I write a demo to reappear what I meat. Here is my gulpfile.js:
gulp-rev-collector
'use strict' let gulp = require('gulp'); let rev = require('gulp-rev'); let revController = require('gulp-rev-collector'); let minifyHTML = require('gulp-minify-html'); let DIST = './dist'; gulp.task('default', ['css', 'js', 'index']); gulp.task('css', () => { gulp.src('./src/**.css') .pipe(rev()) .pipe(gulp.dest(DIST)) .pipe(rev.manifest('css-map.json', { merge: true })) .pipe(gulp.dest(DIST)); }); gulp.task('js', () => { gulp.src('./src/**.js') .pipe(rev()) .pipe(gulp.dest(DIST)) .pipe(rev.manifest('js-map.json', { merge: true })) .pipe(gulp.dest(DIST)); }); gulp.task('index', () => { gulp.src([DIST + '/**.json', './src/index.html']) .pipe(revController()) .pipe(minifyHTML({ empty: true, spare: true })) .pipe(gulp.dest(DIST)); });
I found if I directly run gulp, link and script tag in index.html did not be replaced by url with md5, but if I run gulp index, it works. So I guess, maybe when collector runs the manifest file generate by gulp-rev has not created.
gulp
link
script
url
md5
gulp index
collector
manifest file
gulp-rev
I found where I am wrong: I didn't return in every task which task index depends, I'm sorry~~
return
index
HI, I'm using
gulp-rev-collector
and found it not working. I write a demo to reappear what I meat. Here is my gulpfile.js:I found if I directly run
gulp
,link
andscript
tag in index.html did not be replaced byurl
withmd5
, but if I rungulp index
, it works. So I guess, maybe whencollector
runs themanifest file
generate bygulp-rev
has not created.