Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the asset pipeline rails 3.1 waste cycles?

In rails 3.1, does .coffee and //= require files get processed only once or with each asset request?

For example,I have a file


//= require source/main.js.coffee
//= require source/second.js.coffee
//= require source/third.js.coffee

Ideally, the server would compile these to js ONCE, then bundle them, then create a static file. But if it happens on each asset requests,it's going to be wasting cycles repeating it??

Thanks for any guidance on this.

like image 584
Abhaya Avatar asked Jul 04 '11 05:07

Abhaya


1 Answers

Yes, the assets will be compiled AND cached. So they won't generate additional cycles. You can also pre-compile them before you push them to production.

Here is a good writeup: http://blog.nodeta.com/2011/06/14/rails-3-1-asset-pipeline-in-the-real-world/

like image 109
Wukerplank Avatar answered Sep 19 '22 13:09

Wukerplank