【问题标题】:How to run grunt watch without running its tasks at the beginning?如何在不运行任务的情况下运行 grunt watch?
【发布时间】:2017-06-05 00:27:21
【问题描述】:

每次我运行“grunt”时,我的 JS 和 CSS 文件都会被 uglified 和 linted。如何在 watch 运行开始时不运行 uglify 和 jshint,只在保存时运行这些任务?

watch: {
         // Samples.js
         samplesJS: {
            files: ['**/*.js'],
            tasks: ['jshint:samplesJshint', 'uglify:samplesUglify'],
         },
         // Samples-style.css
         samplesCSS: {
            files: ['**/*.css'],
            tasks: ['cssmin:samplesCSSMin'],
         },
         // Blogs.js
         blogsJS: {
            files: ['**/*.js'],
            tasks: ['jshint:blogsJshint', 'uglify:blogsUglify'],
         }
      }

grunt.registerTask('default', ['jshint', 'uglify', 'cssmin', 'watch']);

【问题讨论】:

    标签: gruntjs watch build-system


    【解决方案1】:

    从默认任务中删除它们:

    grunt.registerTask('default', ['watch']);
    

    或者只运行grunt watch,它会运行监视任务而不触发其他任务。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-04
      • 2013-05-25
      • 2015-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-23
      相关资源
      最近更新 更多