加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-17 06:47:02 所属栏目:安全 来源:网络整理
导读:我是一个咕噜咕噜的新手.我的电脑运行 Windows 7 x64. 我按照Yeoman教程(在Yeoman网站上),我没有改变任何生成的文件.然后,我跑了 grunt serve 当我更改任何html文件时,grunt进程是即时的,但是当我修改.js或.css文件之一时,进程非常慢.当我点击保存时,咕噜声
我是一个咕噜咕噜的新手.我的电脑运行 Windows 7 x64.

我按照Yeoman教程(在Yeoman网站上),我没有改变任何生成的文件.然后,我跑了

grunt serve

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

>> File "appstylesindex.css" changed

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

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

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

Running "newer-timestamp:copy:styles:R:PersonnelWorkspaceswebfrontplumenode_modulesgrunt-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...odulesgrunt-newer.cache   3ms  ■■■ 5%
autoprefixer                                             1ms  ■ 2%
autoprefixer:dist                                       39ms  ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 59%
Total 66ms
... Reload .tmpstylesindex.css ...
... Reload .tmpstylesmain.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选项有时会使事情变得更快 – 而且更容易出现明显的失败.

从documentation:

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
  },

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读