Gulp 在 Windows 上的运行速度比在 Mac 上慢 4 倍。我已经添加了 gulp 文件以及下面的命令行输出。gulpfile 非常简单。
这是命令行输出:
$ gulp
[14:00:06] Using gulpfile c:\gulpSample\gulpfile.js
[14:00:06] Starting 'scripts'...
[14:00:07] Finished 'scripts' after 26 ms
[14:00:07] Starting 'watch'...
[14:00:07] Finished 'watch' after 30 ms
[14:00:07] Starting 'default'...
[14:00:07] Finished 'default' after 23 μs
mac 上的时间通常快 4 倍
这是 gulp 文件:
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var sass = require('gulp-ruby-sass');
//var plumber = require('gulp-plumber');
//scripts Task
//uglifies
function errorLog(error){
console.error.bind(error);
this.emit('end');
}
gulp.task('scripts', function(){
gulp.src('js/*.js')
//.pipe(plumber())
.pipe(uglify())
.on('error', errorLog)
.pipe(gulp.dest('build/js'));
});
//Watch Task
gulp.task('watch', function(){
gulp.watch('js/*.js',['scripts']);
gulp.watch('scss/*.scss',['styles']);
});
gulp.task('default',['scripts','watch']);