rake assets:precompile is slooooow. Any way to speed it up?

随声附和 提交于 2019-12-07 15:30:54

问题


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.

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.

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.

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?


回答1:


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.



来源:https://stackoverflow.com/questions/9546831/rake-assetsprecompile-is-slooooow-any-way-to-speed-it-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!