我只需要在两个不同的文件夹上运行一些吞咽任务。
我的项目文件夹结构示例:
- Project
- componentA
- componentB
- componentC
- componentD我需要用componentA和componentB执行任务,而不是在C/D中执行任务。
目前,我正在使用以下脚本。
你能告诉我如何为B增加这项任务吗?
你知道其他的/更好的方法吗?
// include gulp
var gulp = require('gulp');
// include plug-ins
var jshint = require('gulp-jshint');
// JS hint task
gulp.task('jshint', function () {
gulp.src('./componentA/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});发布于 2015-08-13 19:37:43
下面使用匹配直接排除C和D
(注:我正在使用concat进行测试)
var gulp = require('gulp');
var concat = require('gulp-concat');
var files = './component!(C|D)/*.txt';
gulp.task('test', function(){
gulp.src(files)
.pipe(concat('all.txt'))
.pipe(gulp.dest('./'));
});对你来说
'./component!(C|D)/**/*.js'发布于 2015-08-13 19:02:49
我能够用下面的代码解决这个问题。欢迎任何更好的方法或替代办法。
// include plug-ins
var jshint = require('gulp-jshint');
var folders = [
'./componentA/**/*.js',
'./componentB/**/*.js'
];
// JS hint task
gulp.task('jshint', function () {
gulp.src(folders)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});https://stackoverflow.com/questions/31996249
复制相似问题