Wednesday, October 17, 2012

Re: [Rails] Not all javascript files for asset pipeline:

On 17 October 2012 12:47, Soichi Ishida <lists@ruby-forum.com> wrote:
> Rails 3.1.3
>
> 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.

Are you worried about the server or the user's PC running the browser?
If it is the user then you need not worry. I believe that the
browser will only fetch the file once for each session, it will not
fetch it for every page. Similarly on the server they will only be
compiled once each time you change anything, and will only be served
to the browser when it asks for them.

Colin

>
> Is there anyway to avoid it?
>
> I suppose we can put some javascript files in lib/assets/javascripts/
> directory, and
>
> <script type="text/javascript"
> src="/lib/assets/javascripts/geodesic.js"></script>
>
> in the page that requires the particular file.
>
> Does this work? Because I cannot figure out the route required for this.
>
> soichi
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate