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']);*/
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。