【发布时间】:2015-12-10 15:26:39
【问题描述】:
我需要从我的 gulpfile 中最小化 gulp 命令的数量。
这是我的 JS 文件夹
js/
templates/
t-01/
t-02/
[...]
t-xxx/
我对 JS 的 gulp 任务(使用 livereload)
gulp.task('da-js', function() {
gulp.src([
'js/templates/**/*.js',
'!js/templates/**/*.min.js'
])
.pipe(concat('app.min.js'))
.pipe(gulp.dest('js/templates'))
.pipe(livereload());
});
此任务是全局的,目标文件夹是templates,但我想检测 js 文件的当前文件夹,例如:
- 我在
/templates/t-01/改js -
gulp.watch正在启动 -
app.min.js仅在此文件夹中生成t-01
我知道gulp.dest 不适合定位当前文件夹,但我不知道该怎么做。
感谢您的帮助:)
【问题讨论】:
-
您是否监视
templates文件夹下的所有文件以进行更新,以便此文件夹下任何JS 文件的任何更改都会再次生成您的app.min.js?
标签: javascript gulp gulp-watch gulp-concat gulp-livereload