【问题标题】:how to use grunt concurrent module?如何使用 grunt 并发模块?
【发布时间】:2016-04-01 07:57:21
【问题描述】:

我正在使用 grunt 并发

 grunt.initConfig({
                  concurrent: {
                    options: {
                        logConcurrentOutput: true
                   },
                  prod: {
                       tasks: ["watch:A", "watch:C"]
                  },
                  dev: {
                     tasks: ["watch:B", "watch:C"]
                  }
                  }
              });
             grunt.loadNpmTasks('grunt-concurrent');
             grunt.registerTask("prod", ["concurrent:prod"]);
             grunt.registerTask("dev", ["concurrent:dev"]);
             grunt.tasks(['dev'], {}, function(args) {



});

我有这个错误,它没有正确执行。

 Running "concurrent:dev" (concurrent) task

      Usage: sails [command]

      Commands:

        version               
        lift [options]        
        new [options] [path_to_new_app]
        generate              
        console               
        consle                
        consloe               
        c                     
        www                   
        debug                 
        configure             
        help                  

      Options:

        -h, --help     output usage information
        -v, --version  output the version number
        --silent       
        --verbose      
        --silly        


      Usage: sails [command]

      Commands:

        version               
        lift [options]        
        new [options] [path_to_new_app]
        generate              
        console               
        consle                
        consloe               
        c                     
        www                   
        debug                 
        configure             
        help                  

      Options:

        -h, --help     output usage information
        -v, --version  output the version number
        --silent       
        --verbose      
        --silly        
    Done, Without errors.

我有这个输出,我需要使用 grunt-concurrent 正确执行一项任务。你能帮助我吗?你能给出一些代码吗?如何通过并发运行自定义任务?

【问题讨论】:

    标签: gruntjs grunt-concurrent


    【解决方案1】:

    这是一个工作示例。希望这会有所帮助!

    module.exports = function(grunt) {
    
        grunt.initConfig({
           nodemon: {
               dev: {
                   script: 'server.js'
               }
           },
    
            jshint: {
                files: ['Gruntfile.js', 'app/views/js/**/*.js', 'test/**/*.js'],
                options: {
                    globals: {
                        jQuery: true
                    }
                }
            },
    
            watch: {
                files: ['<%= jshint.files %>'],
                tasks: ['jshint']
            },
    
           concurrent: {
                options: {
                    logConcurrentOutput: true
                },
                tasks: ['nodemon','watch']
            }
        });
    
        grunt.loadNpmTasks('grunt-contrib-jshint');
        grunt.loadNpmTasks('grunt-nodemon');
        grunt.loadNpmTasks('grunt-contrib-watch');
        grunt.loadNpmTasks('grunt-concurrent');
        grunt.registerTask('default',['concurrent', 'jshint']);
    };
    

    【讨论】:

      猜你喜欢
      • 2014-11-07
      • 2015-05-14
      • 1970-01-01
      • 2013-11-16
      • 1970-01-01
      • 2015-03-07
      • 2013-04-20
      • 2013-10-12
      • 2014-08-23
      相关资源
      最近更新 更多