On Wed, Oct 17, 2012 at 6:47 AM, Soichi Ishida <li...@ruby-forum.com> wrote:
> Not all javascript files are necessary for every page of app.
> If I put all JavaScript files in app/assets/javascripts/ , all of them
> are compiled and read in every page.  I believe this is a waste of
> memory space and CPU load.

Why are you serving assets from Rails /period/ without caching if you
are so worried about CPU load?  I would be more worried about the user
load time than my own CPU usage on a server for such a trivial action
(trivial because you can cache it to a static file)

> Is there anyway to avoid it?

Stop requiring the appname.js file since it uses sprockets to require
the entire tree, include each individual file.  Or you could adjust
the appname.js file and stop it from requiring each asset in the tree
but I prefer just to delete it entirely and include the specific files
I need.

Example: <%= javascript_include_tag :jquery %>
On some:
    <% if @page && @page.role == :post %>
      <%= javascript_include_tag :jquery %>
    <% end %>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to