gulp-turbo
Version:
前端工作流(requirejs/jade/stylus/coffee),完整强缩进工作流,同步异步模板复用,高效率适合初期前端团队
40 lines (34 loc) • 1.77 kB
text/coffeescript
gulp = require 'gulp'
chalk = require 'chalk'
util = require 'gulp-util'
sequence = require 'gulp-sequence'
gulp.task 'watch',[],()->
pkg = global.pkg
{approot,wwwroot,distMode} = pkg
if distMode is 'dev'
jade_watcher = gulp.watch approot + '/src/**/*.jade', ['jade']
jade_watcher.on 'change', (event)->
util.log chalk.green('[File change] ') + event.path + ' was ' + event.type + ', running jade tasks...'
stylus_watcher = gulp.watch approot + '/src/**/*.styl', ['stylus']
stylus_watcher.on 'change', (event)->
util.log chalk.green('[File change] ') + event.path + ' was ' + event.type + ', running stylus tasks...'
coffee_watcher = gulp.watch [approot + '/src/**/*.coffee',approot + '/src/**/*.js',approot + '/src/coffee/require-conf.json'], ['coffee']
coffee_watcher.on 'change', (event)->
util.log chalk.green('[File change] ') + event.path + ' was ' + event.type + ', running coffee tasks...'
cpImg_watcher = gulp.watch [approot + '/src/img/**/*.*'], ['cpImg']
cpImg_watcher.on 'change', (event)->
util.log chalk.green('[File change] ') + event.path + ' was ' + event.type + ', running cpImg tasks...'
cpVender_watcher = gulp.watch [approot + '/src/vender/**/*.*'], ['cpVender']
cpVender_watcher.on 'change', (event)->
util.log chalk.green('[File change] ') + event.path + ' was ' + event.type + ', running cpVender tasks...'
else
rebuild_watcher = gulp.watch [approot + '/src/**/*.*'], ['build']
rebuild_watcher.on 'change', (event)->
util.log chalk.green('[File change] ') + event.path + ' was ' + event.type + ', running rebuild tasks...'