I was in chapter 5 of the Ruby on Rails, and I come across "Asset pipeline" when R-o-R detect and jam all css and js files into one. It''s true that Browser will have to make less requests, but at the same time, the browser will potentially have to process more code than it should? For example, I use a slider jquery plugin in gallery page, since R-o-R fuse the plugin with all other js files into 1 javascript.js, the plugin will be included in about page, home page and so on... Can I import separated files for separated pages? and how? Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/29e8b9dd-e703-47ef-889a-e9aadee69a95%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Hi, Yes, you can include seperate files when needed. But when the code is minified in one. If you use the same file for every page of your application, there will be few requests and the the CSS file and JS file will be cached. I advise this article which recaps the Asset Pipeline feature: http://coderberry.me/blog/2012/04/24/asset-pipeline-for-dummies/ To create different independent stylesheet or javascript file, see this question:> Q: How can I precompile additional assets without having to include them > in the manifest?Generally in a website, the HTTP request is more longest than reading process the code. After if you''re not sure you can benchmark your application to see what solution is the best. Best regards. Le dimanche 26 mai 2013 04:18:32 UTC+2, Keo Hoang Minh a écrit :> > I was in chapter 5 of the Ruby on Rails, and I come across "Asset > pipeline" when R-o-R detect and jam all css and js files into one. > > It''s true that Browser will have to make less requests, but at the same > time, the browser will potentially have to process more code than it should? > > For example, I use a slider jquery plugin in gallery page, since R-o-R > fuse the plugin with all other js files into 1 javascript.js, the plugin > will be included in about page, home page and so on... > > Can I import separated files for separated pages? and how? > > Thanks >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a802228c-8b9f-4efe-b3db-871abf3e3edb%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On Sat, May 25, 2013 at 9:18 PM, Keo Hoang Minh <keohoangminh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I was in chapter 5 of the Ruby on Rails, and I come across "Asset pipeline" > when R-o-R detect and jam all css and js files into one.Bundles are quite common now. Even for non Rails-ists.> It''s true that Browser will have to make less requests, but at the same > time, the browser will potentially have to process more code than it should?It''s true it will make less requests, it''s false that it will require more processing, it will require the same amount of processing whether split up into 10 requests or 1. That is if we discount all the other processing that happens before and after the parsing of your sources.> For example, I use a slider jquery plugin in gallery page, since R-o-R fuse > the plugin with all other js files into 1 javascript.js, the plugin will be > included in about page, home page and so on...You can create separate bundles that don''t include everything, application.js should give you an example on your first install, and even if it does not the source that is there is pretty self explanatory if you ask me. And even if you just drop it from the bundles period you can still require it individually by hitting up /assets/name.js.> Can I import separated files for separated pages? and how?https://github.com/sstephenson/sprockets#the-directive-processor -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAM5XQnxBPK8E5V5ma1iMzCEySi2%2B_4KSHemPQSsVLp%2Bfpqfnsw%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.