gulp 学习笔记3 watch
gulp.watch 监视文件并且可以在文件发生改动时候做一些事情。
var gulp = require('gulp') var uglify = require('gulp-uglify') var cleancss = require('gulp-clean-css') gulp.task('scripts',function () { gulp.src('app/js/*.js') .pipe(uglify()) .pipe(gulp.dest('build/js')) }) gulp.task('styles',function () { console.log('run minify css') }) //watch task //watch js gulp.task('watch',function () {s gulp.watch('app/js/*.js',['scripts']) }) gulp.task('default',['scripts','styles','watch'])