我希望能够将gulp
中的watch
任务添加到frontend/js
中的所有js
文件和下面的任何其他js文件中
gulp.watch('./frontend/js/**/*.js', ['browserify']);
这将仅针对一个文件夹深度的js
文件
发布于 2014-12-18 00:47:41
我刚刚做了一些测试--这对我来说工作得很好。
我目前有以下结构-
--apps
--scripts
----test.js
----test-folder
------test2.js
------test-folder-deep
--------test3.js
--myApp
----scripts-symlinked (symlinked to apps/scripts)
----gulpfile.js
我使用以下命令设置我的符号链接文件夹(在Mac上-从'myApp‘文件夹):
ln -s /Users/kandrews/apps/scripts ./scripts-symlinked
在我的gulpfile.js
中,我有以下内容:
var gulp = require('gulp'),
jshint = require('gulp-jshint');
gulp.task('jshint', function () {
gulp.src('./scripts-symlinked/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('watch', function () {
gulp.watch('./scripts-symlinked/**/*.js', ['jshint']);
});
效果很好。我也在一个子目录(‘scripts/symlinked scripts’)中尝试了一下,也是成功的。
发布于 2020-05-27 03:56:16
我认为这不值得去做困难的事情:
gulp.watch('./frontend/js/', ['browserify']);
https://stackoverflow.com/questions/27526891
复制相似问题