gulpfile.js:

var gulp = require('gulp'),

    minifycss = require('gulp-minify-css'),

    uglify = require('gulp-uglify');

var assetRev = require('gulp-asset-rev');

 

gulp.task('rev',['revCss','revJs','revImg'],function() {

    gulp.src("./*.html")

        .pipe(assetRev())

        .pipe(gulp.dest('./dest'));

});



gulp.task('revCss',function () {

    return gulp.src('./css/*.css')

        .pipe(minifycss())

        .pipe(assetRev())

        .pipe(gulp.dest('./dest/css/'))

});


gulp.task('revJs',function () {

    return gulp.src('./js/*.js')

        .pipe(uglify())

        .pipe(assetRev())

        .pipe(gulp.dest('./dest/js/'))

});


gulp.task('revImg',function () {

    return gulp.src('./img/*')

        //.pipe(assetRev())

        .pipe(gulp.dest('./dest/img/'))

});


gulp.task('default',['rev']);




/**

 * 

 * 只添加版本号不压缩 

 * 

 */

/*var gulp = require('gulp');

var assetRev = require('gulp-asset-rev');

 

gulp.task('rev',['revCss','revJs','revImg'],function() {

    gulp.src("./*.html")

        .pipe(assetRev())

        .pipe(gulp.dest('./dest'));

});



gulp.task('revCss',function () {

    return gulp.src('./css/*.css')

        .pipe(assetRev())

        .pipe(gulp.dest('./dest/css/'))

});


gulp.task('revJs',function () {

    return gulp.src('./js/*.js')

        .pipe(assetRev())

        .pipe(gulp.dest('./dest/js/'))

});


gulp.task('revImg',function () {

    return gulp.src('./img/*')

        //.pipe(assetRev())

        .pipe(gulp.dest('./dest/img/'))

});


gulp.task('default',['rev']);*/