grunt watch任务块命令行 [英] grunt watch task block the command line

查看:245
本文介绍了grunt watch任务块命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的咕噜,还在学习,所以我想出了一个非常奇怪的问题。
当我运行watch任务时,我的命令行被阻止,所以基本上我不能做任何事情。
请记住,任务已成功完成。
这是我的命令行输出:

I'm new to grunt, still learning, so I came up to a very strange problem. When I run "watch" task, my command line becomes blocked, so basically I cant do anything on it. Bare in mind that the task is completed with success. This is my command line output:

C:\server\css-test>grunt w
Running "watch" task
Waiting...OK
>> File "compass-examples-master\02\sass\screen.scss" changed.

Running "compass" (compass) task
unchanged compass-examples-master/02/sass/ie.scss
unchanged compass-examples-master/02/sass/print.scss
overwrite compass-examples-master/02/stylesheets/new/sass/screen.css

Running "watch" task

Completed in 1.496s at Fri Mar 22 2013 19:31:37 GMT+0100 (Central Europe Standard Time) - Waiting...

如你所见,我所做的是运行compass任务,它成功完成。

As you can see, all I do is run "compass" task, it completes successfully.

插入等待... 文本部分后,点继续闪烁,但键盘输入无效。

Insertion point keeps blinking on after the Waiting... text part, but keyboard input doesn't work.

grunt配置

module.exports = function (grunt)
{

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        compass: {
            dist: {
                options: {
                    sassDir: 'compass-examples-master/02',
                    cssDir: 'compass-examples-master/02/stylesheets/new',
                    imagesDir: 'compas-examples-master/02/images',
                    boring: false,
                    outputStyle: 'nested',
                    require: 'sass-media_query_combiner'
                }
            }
        },
        watch: {
            files: 'compass-examples-master/02/sass/*',
            tasks: ['c']
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-compass');


    grunt.registerTask('c', 'compass');
    grunt.registerTask('w', 'watch');

};


推荐答案

我没有使用grunt手表,问题是它是一个持续运行的进程,并且默认情况下,您的命令行通常一次运行一个进程。您可以使用3种解决方案。

I havn't used grunt watch, however I believe the problem is that it is a continuously running process, and by default your command line will typically run one process at a time. There are 3 solutions you can use.


  1. 打开一个新终端。你可以一次打开多个,这将允许你使用第二个作为你的主终端,而咕噜手表占据另一个。

  2. 使用&符号在你的命令。这将开始该过程,并立即返回命令行给你,允许你使用它的其他事情。您可以将其视为在后台运行命令。该过程仍然连接到终端窗口,因此如果您关闭窗口,过程将结束。

  1. Open a new terminal. You can have multiple open at once, and this will allow you to use the second as your main terminal while grunt watch occupies the other.
  2. Use the & symbol in your command. This will begin the process and immediately return the command line to you, allowing you to use it for other things. You can think of it as running the command in the background. The process is still connected to the terminal window, so if you close the window, the process will end.


grunt w& p>

grunt w &


  • 在命令中使用(&)。

  • Use ( &) around your command. This will run in the background the same as just &, however the process will not be killed when you close the terminal window.


    (grunt w &)


  • 这篇关于grunt watch任务块命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆