shonny-ua / gulp-rev-collector

Static asset revision data collector from manifests, with was generated from different streams and replace they's links in html template.
MIT License
150 stars 41 forks source link

The html file cannot work well #24

Closed jacsonLee closed 8 years ago

jacsonLee commented 8 years ago

I use gulp-rev to generate the css file with hashcode and generate the rev-manifest,but when I use gulp-rev-collector the replace the css in my html file.It just generate the html in my target dir but the generated html keep its before name in head tag.So I did not replace my static resource. Here is my code And some thing about it:

var gulp = require("gulp");
var concat = require("gulp-concat");
var minifyCss = require("gulp-minify-css");
var rev = require('gulp-rev');
var revCollector = require('gulp-rev-collector');

var path = [
    'app/css/quotedPrice.css',
    'app/css/style.css',
    'app/css/strategy.css',
    'app/css/subject.css'
]

gulp.task('concat',function() {
    gulp.src(path)
        .pipe(concat('wap.min.css'))
        .pipe(minifyCss())
        .pipe(rev())
        .pipe(gulp.dest('app/build/css'))
        .pipe(rev.manifest())
        .pipe(gulp.dest('app/rev'));
});

gulp.task('rev',['concat'],function () {
    gulp.src(['app/rev/*.json','app/discount.html'])
        .pipe(revCollector({
            replaceReved:true,
            dirReplacements:{
                'css':"app/build/css"
            }
        }))
        .pipe(gulp.dest('app/build'));
});

gulp.task('default', ['concat', 'rev']);
shonny-ua commented 8 years ago

Hmmm... It's very strangely. At the first blush all is ok. The 'rev' task is depends on 'concat' task.

What about try different definition for 'default' task? To vit gulp.task('default', ['rev']);

jacsonLee commented 8 years ago

It work! thanks!