本文介绍了耙式资产:预编译是缓慢的.有什么办法可以加快速度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Heroku上运行的Rails 3.2应用程序,它使用CKEditor.现在,CKEditor是文件和文件夹的相当大的集合,并且可能是预编译资产所花费时间的最大贡献者.定期将Heroku推送到资产上需要花费一分钟以上的时间:预编译步骤.

I have a Rails 3.2 app running on Heroku, and it uses CKEditor. Now, CKEditor is a pretty large collection of files and folders, and is probably the biggest contributor to the time it takes to precompile assets. A regular push to Heroku takes well over a minute on the assets:precompile step.

因此,我现在在本地进行预编译,并且只有在进行编辑后才能推送到Heroku,以缩短部署时间.但是,我可怜的旧Windows笔记本电脑很容易因为耙资产而中断15分钟:预编译.这使得对js或css文件进行较小的编辑或添加变得非常痛苦.

So I now precompile locally, and only when I've made edits, before I push to Heroku, to shorten deploy times. However, my poor old Windows laptop easily breaks 15 minutes for rake assets:precompile. This makes it a huge pain to make minor edits or additions to js or css files.

我确实有Heroku文档所要求的config.assets.initialize_on_precompile = false.但是我很确定实时生猪是压缩的,即Uglifier.

I do have config.assets.initialize_on_precompile = false as required by Heroku docs. But I'm pretty sure the real time hog is compression, i.e. Uglifier.

有人对我如何解决这个问题有建议吗?我只是做错了吗?有没有办法只编译更改的文件?我可以/应该直接将CKEditor移到公共目录以避免预编译吗?

Does anyone have a suggestion to how I can remedy this? Am I simply doing it wrong? Is there a way to only compile changed files? Could/should I move CKEditor directly to the public dir to avoid precompiling?

推荐答案

您可以尝试仅将资产加载到已更改的文件上,这将极大地加快编译过程.您可以使用turbo-sprockets-gem轻松地做到这一点.

You can try to load the assets only on the changed files which would speed up compiling process by a huge margin. You can easily do so using turbo-sprockets-gem.

https://github.com/ndbroadbent/turbo-sprockets-rails3

文档非常简单.希望这会有所帮助.

The documentation is pretty straight forward. Hope this helps.

这篇关于耙式资产:预编译是缓慢的.有什么办法可以加快速度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 16:15
查看更多