在不阻塞终端的情况下运行Grunt Watch?

时间:2014-11-04 16:56:58

标签: javascript node.js visual-studio gruntjs

我有一个运行concat的Grunt文件,然后是一个监视器,如果有任何变化,就会重新连接。

问题是它会阻塞终端。

我将此作为Visual Studio后期构建操作运行,这意味着该程序永远不会启动。

有没有办法运行它以便它不会阻塞?

这是我的grunt文件的样子:

module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        concat: {
            js: {
                src: ['public/app/**/*.js'],
                dest: 'public/app/app.js'
            },
            css: {
                src: ['public/app/**/*.css'],
                dest: 'public/app/app.css'
            }
        }, 
        concurrent: {
            watch: ['watch']
        },
        watch: {
            files: ['public/app/**/*.js', 'public/app/**/*.css', '!public/app/app.js', '!public/app/app.css'],
            tasks: ['concat']
        }
    });

    require('load-grunt-tasks')(grunt);

    grunt.registerTask('default', ['concat', 'concurrent:watch']);
};

1 个答案:

答案 0 :(得分:0)

可以通过运行命令来运行grunt作为进程:

在Windows上

start grunt

在Linux上

grunt &
相关问题