gulp之压缩css

复制代码
/**
 * css压缩
 * npm install --save-dev gulp-minify-css
 * npm install --save-dev gulp-rename
 * 
 * 
 * 可参考:
 * https://www.npmjs.com/package/gulp-minify-css
 * https://github.com/hparra/gulp-rename 
 */
var minifyCss = require('gulp-minify-css');
var rename = require("gulp-rename");

gulp.task('css', function() {
    return gulp.src('../css/*')
        .pipe(minifyCss())
        .pipe(rename(function (path) {
            path.basename += "-min";
            return path;
          }))
        .pipe(gulp.dest('../css/'));
});
复制代码

 

posted @   simonbaker  阅读(251)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示