iul*_*ust 5 angularjs gruntjs yeoman
我是一个咕噜咕噜的新手.我的电脑运行Windows 7 x64.
我按照Yeoman教程(在Yeoman网站上),我没有改变任何生成的文件.然后,我跑了
grunt serve
Run Code Online (Sandbox Code Playgroud)
当我更改任何html文件时,grunt进程是即时的,但是当我修改.js或.css文件之一时,进程非常慢.当我点击保存时,咕噜声立即注意到:
>> File "app\styles\index.css" changed
Run Code Online (Sandbox Code Playgroud)
但是在终端上出现下一行之前似乎有大约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) -
Run Code Online (Sandbox Code Playgroud)
等候...
我糊涂了.grunt说他总共花了66毫秒来完成任务,但后来说他花了4.463秒来完成整个过程.
我做错了什么?构建很干净,我什么也没做
yo angular
Run Code Online (Sandbox Code Playgroud)
支持应用程序...任何想法?
编辑:
spawn: false
解决了我的问题.感谢那个提起这件事的人.即使我现在使用Gulp或webpack.
有一个spawn选项有时可以使事情变得更快,但也更容易明显失败。
从文档中:
是否生成任务在子进程中运行。将此选项设置为 false 可加快手表的反应时间(大多数情况下通常快 500 毫秒),并允许后续任务运行共享相同的上下文。不生成任务运行可能会使手表更容易出现故障,因此请根据需要使用。
您可以在 Gruntfile.js 中添加一个options部分来禁用生成。watch像这样的东西。
watch: {
options: {
spawn: false
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1592 次 |
| 最近记录: |