简体   繁体   English

无限吞没手表循环

[英]infinite gulp watch loop

Trying to figure out my gulpfile.js (newbie) 试图找出我的gulpfile.js(新手)

Here's the gulpfile.js, once i run gulp it just keeps running. 这是gulpfile.js,一旦我运行gulp,它就会一直运行。 There's no bundle command which i've read in some other posts. 我在其他一些帖子中没有阅读过bundle命令。 I just want it obviously to take notice to any changes and run once until the next change. 我只希望它明显地注意到任何更改并运行一次直到下一次更改。

/* Required */
var gulp = require('gulp'),
    uglify = require('gulp-uglify');
    rename = require('gulp-rename');


/* Scripts Task */
gulp.task('scripts', function(){
    gulp.src(['app/js/**/*.js', '!app/js/**/*/min.js'])
    .pipe(rename({suffix:'.min'}))
    .pipe(uglify())
    .pipe(gulp.dest('app/js'));
});

/* Watch Task */
gulp.task('watch', function(){
    gulp.watch('app/js/**/*.js', ['scripts']);
});

/* Default Task */
gulp.task('default', ['scripts', 'watch']);

'!app/js/**/*/min.js' should be '!app/js/**/*min.js' . '!app/js/**/*/min.js'应该是'!app/js/**/*min.js'

As the second one does not match any files ending in min.js in all sub-directories of app/js . 由于第二个与app/js所有子目录中以min.js结尾的文件都不匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM