Gulp:为什么“ jshint”不能在文件更改时运行?

米莎·莫罗什科(Misha Moroshko)

这是我的相关部分gulpfile.js

var paths = {
  sass:    ['./www/**/*.scss'],
  scripts: ['./www/**/*.js', '!./www/lib/**/*.js']
};

gulp.task('jshint', function(done) {
  console.log('Running jshint');
  gulp.src(paths.scripts)
      .pipe(jshint())
      .pipe(jshint.reporter('default'))
      .on('end', done);
});

gulp.task('scripts', function(done) {
  console.log('Running scripts');
  gulp.src(paths.scripts)
      .pipe(concat('chessmate.js'))
      .pipe(gulp.dest('./www/'))
      .on('end', done);
});

gulp.task('sass', function(done) {
  gulp.src('./www/ionic.app.scss')
      .pipe(sass({
        errLogToConsole: true,
        includePaths: []
      }))
      .pipe(concat('chessmate.css'))
      .pipe(gulp.dest('./www/'))
      .on('end', done);
});

gulp.task('watch', function() {
  gulp.watch(paths.sass, ['sass']);
  gulp.watch(paths.scripts, ['jshint', 'scripts']);
});

gulp.task('default', ['jshint', 'scripts', 'sass', 'watch']);

当我运行时gulp,两者jshintscripts都运行:

[gulp] Using gulpfile /Users/mishamoroshko/ChessMate/gulpfile.js
[gulp] Starting 'jshint'...
Running jshint
[gulp] Starting 'scripts'...
Running scripts
[gulp] Starting 'sass'...
[gulp] Starting 'watch'...
[gulp] Finished 'watch' after 93 ms

但是,如果我更新app.js,则仅scripts运行:

[gulp] Starting 'scripts'...
Running scripts
[gulp] Finished 'scripts' after 396 ms

为什么jshint不运行?

米莎·莫罗什科(Misha Moroshko)

显然,从以下样式更改:

gulp.task('taskname', function(done) {
  [do stuff].on('end', done);
});

对此:

gulp.task('taskname', function() {
  return [do stuff];
});

解决了问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

为什么Gulp不忽略文件?

来自分类Dev

为什么Windows EXE文件不能在Linux上运行?

来自分类Dev

为什么我的php文件不能在xamppp上运行?

来自分类Dev

为什么我不能在 Pycharm 上运行我的文件?

来自分类Dev

为什么我的xmodmap命令不能在启动/登录时运行?

来自分类Dev

为什么我的xmodmap命令不能在启动/登录时运行?

来自分类Dev

为什么“ gulp测试”会运行两次测试?

来自分类Dev

为什么我的gulp任务停止生成我的CSS文件?

来自分类Dev

gulp为什么不创建CSS目标文件夹?

来自分类Dev

为什么Gulp-Watch不会删除文件

来自分类Dev

为什么gulp-filter不能在我的Bower软件包中过滤出更少的文件

来自分类Dev

为什么gulp-filter不能在我的Bower软件包中过滤出更少的文件

来自分类Dev

为什么这些线程ActiveRecord查询不能同时运行?

来自分类Dev

为什么我的CSS动画不能同时运行?

来自分类Dev

为什么我不能在批处理文件中运行此Powershell脚本?

来自分类Dev

为什么不能在Windows中更改打开文件的名称?

来自分类Dev

为什么实时重装不能与gulp-connect一起使用?

来自分类Dev

为什么“ gulp-jest”失败了:“请使用--harmony标志运行节点!”?

来自分类Dev

Gulp任务在没有'return'语句的情况下运行得更快-为什么?

来自分类Dev

为什么我的测试不能在MySQL上运行?

来自分类Dev

为什么MutationObserver代码不能在Chrome 30上运行?

来自分类Dev

为什么if块不能在最终情况下运行?

来自分类Dev

为什么我的冻结期货不能在单核上运行?

来自分类Dev

为什么我不能在netlify中运行此脚本?

来自分类Dev

为什么@ViewChild不能在AfterViewInit外部运行?

来自分类Dev

为什么我的flask命令不能在Heroku上运行?

来自分类Dev

为什么我的功能规格不能在RSpec中运行?

来自分类Dev

为什么我的函数不能在.resize()上运行?

来自分类Dev

为什么不能在PC上运行OS X?

Related 相关文章

  1. 1

    为什么Gulp不忽略文件?

  2. 2

    为什么Windows EXE文件不能在Linux上运行?

  3. 3

    为什么我的php文件不能在xamppp上运行?

  4. 4

    为什么我不能在 Pycharm 上运行我的文件?

  5. 5

    为什么我的xmodmap命令不能在启动/登录时运行?

  6. 6

    为什么我的xmodmap命令不能在启动/登录时运行?

  7. 7

    为什么“ gulp测试”会运行两次测试?

  8. 8

    为什么我的gulp任务停止生成我的CSS文件?

  9. 9

    gulp为什么不创建CSS目标文件夹?

  10. 10

    为什么Gulp-Watch不会删除文件

  11. 11

    为什么gulp-filter不能在我的Bower软件包中过滤出更少的文件

  12. 12

    为什么gulp-filter不能在我的Bower软件包中过滤出更少的文件

  13. 13

    为什么这些线程ActiveRecord查询不能同时运行?

  14. 14

    为什么我的CSS动画不能同时运行?

  15. 15

    为什么我不能在批处理文件中运行此Powershell脚本?

  16. 16

    为什么不能在Windows中更改打开文件的名称?

  17. 17

    为什么实时重装不能与gulp-connect一起使用?

  18. 18

    为什么“ gulp-jest”失败了:“请使用--harmony标志运行节点!”?

  19. 19

    Gulp任务在没有'return'语句的情况下运行得更快-为什么?

  20. 20

    为什么我的测试不能在MySQL上运行?

  21. 21

    为什么MutationObserver代码不能在Chrome 30上运行?

  22. 22

    为什么if块不能在最终情况下运行?

  23. 23

    为什么我的冻结期货不能在单核上运行?

  24. 24

    为什么我不能在netlify中运行此脚本?

  25. 25

    为什么@ViewChild不能在AfterViewInit外部运行?

  26. 26

    为什么我的flask命令不能在Heroku上运行?

  27. 27

    为什么我的功能规格不能在RSpec中运行?

  28. 28

    为什么我的函数不能在.resize()上运行?

  29. 29

    为什么不能在PC上运行OS X?

热门标签

归档