gulp-turbo
Version:
前端工作流(requirejs/jade/stylus/coffee),完整强缩进工作流,同步异步模板复用,高效率适合初期前端团队
27 lines (24 loc) • 876 B
text/coffeescript
gulp = require 'gulp'
util = require 'gulp-util'
chalk = require 'chalk'
stylus = require 'gulp-stylus'
sourcemaps = require 'gulp-sourcemaps'
through = require 'through2'
_ = require 'lodash'
path = require 'path'
gulp.task 'stylus', ()->
pkg = global.pkg
{base,approot,distMode,distPath} = pkg
if(distMode is 'dist')
isCompress = true
gulp.src [base+'/'+approot+'/src/stylus/**/*.styl','!'+base+'/'+approot+'/src/stylus/module/**/*.styl']
.pipe sourcemaps.init()
.pipe stylus
compress: isCompress
.pipe through.obj (file, enc, cb)->
util.log chalk.magenta('compress ', path.basename(file.path), ' --> ', file.contents.length, 'bytes')
this.push file
cb()
.pipe sourcemaps.write '.maps'
.pipe gulp.dest base+'/'+distPath+'/css/'