我是一个咕噜咕噜的新手.我的电脑运行
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.
解决方法
有一个spawn选项有时会使事情变得更快 – 而且更容易出现明显的失败.
Whether to spawn task runs in a child process. Setting this option to
false speeds up the reaction time of the watch (usually 500ms faster
for most) and allows subsequent task runs to share the same context.
Not spawning task runs can make the watch more prone to failing so
please use as needed.
您将禁用spawn在Gruntfile.js中的watch中添加选项部分.像这样的东西.
watch: { options: { spawn: false },