我对Gulp很陌生 - 我是Grunt的新成员。
我已经设置了我的第一个Gulp文件进行预处理
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var less = require('gulp-less');
var autoprefixer = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var notify = require('gulp-notify');
var gutil = require('gulp-util');
var parentPath = './app/';
var sourceLess = parentPath + 'less';
var targetCss = parentPath + 'css';
var path = require('path');
gulp.task('less', function () {
return gulp.src('./app/less/styles.less')
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(gulp.dest('./app/css'));
});
gulp.task('minify-css', function() {
return gulp.src('./app/css/styles.css')
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('dist'));
});
gulp.task('default', function () {
gulp.watch('app/less/**/*.less', ['less']);
gulp.watch('app/css/styles.css', ['minify-css']);
});
似乎工作很好吧两个问题 -