gulp似乎成为web开发的必选工具。
推荐一个非常好的入门教程
https://markgoodyear.com/2014/01/getting-started-with-gulp/
官方插件列表:
http://gulpjs.com/plugins/
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
rename = require('gulp-rename'),
notify = require('gulp-notify'),
del = require('del');
gulp.task('default', function() {
return sass('src/scss/main.scss', { style: 'expanded' })
// 添加后缀,生成.min.css
// 注意顺序,放到gulp.dest之前
.pipe(rename({suffix: '.min'}))
// 输出目录
.pipe(gulp.dest('dist/assets/css'))
.pipe(notify({ message: 'Default task complete' }));
});
// run gulp clean
gulp.task('clean', function() {
return del(['dist/assets/css', 'dist/assets/js', 'dist/assets/img']);
});