如何在管道中间添加src文件 [英] How to add src files in the middle of a pipe
本文介绍了如何在管道中间添加src文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用'coffee'处理一些文件,添加一些js文件,concat和minify。
I want to process some files with 'coffee', add some js files, concat and minify.
这不工作,咖啡失败的常规js文件:
This does not work, coffee fails on the regular js files:
gulp.task 'build-js', ->
gulp.src([
"bower_components/mbdev-core/dist/js/db.js"
"bower_components/mbdev-core/dist/js/utils.js"
"src/js/config/app.coffee"
"src/js/config/app-db.coffee"
"src/js/accounts/accounts.coffee"
"src/js/budget_items/budget_items.coffee"
"src/js/line_items/line_items.coffee"
"src/js/misc/misc.coffee"
"src/js/reports/report_generators.coffee"
"src/js/reports/reports.coffee"
])
.pipe(coffee()).on('error', gutil.log)
.pipe(concat('app.js'))
.pipe(gulp.dest('public/js'))
$
推荐答案
有没有办法在咖啡部分后添加文件? t需要添加文件到原来的src,而是只使用咖啡if...
You don't need to add files to the original src, but rather to use coffee only "if"...
所以,使用 gulp- / code>
So, use gulp-if
gulp.task('task', function() {
gulp.src('./stuff/*')
.pipe(gulpif(/[.]coffee$/, coffee()))
.pipe(gulp.dest('./dist/'));
});
请参阅这里更多关于gulp-if。
See here more about gulp-if.
这篇关于如何在管道中间添加src文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文