Grunt在干净的自然角度生成设置上非常慢

时间:2014-03-21 00:36:44

标签: angularjs gruntjs yeoman

我是一个咕噜咕噜的新手。我的电脑运行Windows 7 x64。

我按照Yeoman教程(在Yeoman网站上)并且我没有更改任何生成的文件中的任何内容。然后,我跑了

grunt serve

当我更改任何html文件时,grunt进程是即时的,但是当我修改其中一个.js或.css文件时,该过程非常慢。当我点击保存时,咕噜声立即注意到它:

>> File "app\styles\index.css" changed

但是在终端上出现下一行之前似乎有大约4个长秒:

Running "newer:copy:styles" (newer) task

Running "copy:styles" (copy) task
Copied 1 files

Running "newer-timestamp:copy:styles:R:\Personnel\Workspaces\web\front\plume\node_modules\grunt-newer\.cache" (newer-timestamp)
task

Running "newer-reconfigure:copy:styles:1" (newer-reconfigure) task

Running "autoprefixer:dist" (autoprefixer) task
Prefixed file ".tmp/styles/index.css" created.
Prefixed file ".tmp/styles/main.css" created.

Done, without errors.


Execution Time (2014-03-21 00:00:19 UTC)
loading tasks                                            6ms  ■■■■■ 9%
newer:copy:styles                                        9ms  ■■■■■■■■ 14%
copy:styles                                              7ms  ■■■■■■ 11%
newer-timestamp:copy:style...odules\grunt-newer\.cache   3ms  ■■■ 5%
autoprefixer                                             1ms  ■ 2%
autoprefixer:dist                                       39ms  ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 59%
Total 66ms
... Reload .tmp\styles\index.css ...
... Reload .tmp\styles\main.css ...
Completed in 4.463s at Fri Mar 21 2014 01:00:20 GMT+0100 (Paris, Madrid) - 

...等待

我很困惑。 grunt说他总共花了66毫秒来完成任务,但后来说他花了4.463秒来完成整个过程。

我做错了什么?构建是干净的,我没有做任何事情

yo angular

支持应用程序...任何想法?

编辑: spawn: false 解决了我的问题。感谢那个提起这件事的人。即使我现在使用Gulp或webpack。

1 个答案:

答案 0 :(得分:2)

有一个spawn选项有时会让事情变得更快 - 而且更容易出现明显失败。

来自documentation

  

是否在子进程中生成任务运行。将此选项设置为   假加速手表的反应时间(通常快500毫秒)   对于大多数人而言,并允许后续任务运行共享相同的上下文。   不产生任务运行会使手表更容易失败   请根据需要使用。

您将禁用在Gruntfile.js中的options内添加watch部分的spawn。这样的事情。

watch: {
  options: {
    spawn: false
  },
相关问题