简体   繁体   English

资产管道是否符合 3.1 浪费周期?

[英]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?在 rails 3.1 中,does.coffee 和 //= require 文件只处理一次还是每次资产请求都处理?

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.理想情况下,服务器会将这些编译为 js ONCE,然后捆绑它们,然后创建 static 文件。 But if it happens on each asset requests,it's going to be wasting cycles repeating it??但是如果它发生在每个资产请求上,重复它会浪费周期吗?

Thanks for any guidance on this.感谢您对此的任何指导。

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/这是一篇很好的文章: http://blog.nodeta.com/2011/06/14/rails-3-1-asset-pipeline-in-the-real-world/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM