var gulp = require('gulp'); var compass = require('gulp-compass'); gulp.task('compass', function() { ['./', './mobile/', './ws-ydpm/'].forEach(function(dir){ gulp.src(dir+'scss/*.scss') .pipe(compass({ sass: dir+'scss/', css: dir+'css/' })) .pipe(gulp.dest(dir+'css')); }) }); gulp.task('default', function() { gulp.start('compass'); gulp.watch('./**/*.scss', function() { gulp.start('compass'); }); });
注意:要用这个gulp的时候,它forEach的资料夹都要有,而且里面也要有scss/css资料夹及檔案…