>
> And WTH would it load everything as default? Such a bad idea! :)

if you have all the files in 1 and it's cached client side, it is actually
more performant than having many small files. The cost of the multiple IO
calls for each asset is actually greater than  the cost a 1 time download of
the sum of the files due the connection overhead, the caching checks, the
browser limitations and potentially the web server itself (gzip, concurrent
handling etc...).

I would even say than in more than 80% of the cases, loading all the files
at once and for all pages is the best approach. Now, you might have some
pages really heavy in custom JS code and you might want to load this code in
isolation, but that should be an exception.

- Matt


On Tue, Jul 19, 2011 at 4:54 PM, Rafael MVC <[email protected]> wrote:

> But how do you load the specific files?
> Lets say you have a posts_controller and a posts.js, do you do
> javascript_include_tag for it? It would be nice to load it automatically...
> And WTH would it load everything as default? Such a bad idea! :)
>
>
> On Tue, Jul 19, 2011 at 4:49 PM, Matt Aimonetti 
> <[email protected]>wrote:
>
>> The pipeline "compiles" all your js file into 1 so it doesn't really
>> matter since the file will be cached and hopefully minified (I don't think
>> that the minification is currently working).
>> I would however recommend to not use require_tree but to list the files
>> individually to make sure they get loaded in the right order.
>>
>> - Matt
>>
>>
>> On Tue, Jul 19, 2011 at 4:41 PM, Rafael MVC <[email protected]> wrote:
>>
>>> It seems that the standard operation of the asset pipeline is to load all
>>> javascripts from the /apps/assets/javascript into application.js.
>>>
>>> I figure out that is because of the sprocket '//= require_tree .', but is
>>> that really a good option?
>>>
>>> The javascript from a specific page will be loaded in every single page?
>>> So, is there a better way to make the specific javascript be loaded only
>>> for that page? (without having to write content_for :head and
>>> javascript_include_tag for every page)
>>> This feels like a dangerous default to come already set to true.
>>>
>>> Thank you,
>>> Rafael Cardoso
>>>
>>> --
>>> SD Ruby mailing list
>>> [email protected]
>>> http://groups.google.com/group/sdruby
>>
>>
>>  --
>> SD Ruby mailing list
>> [email protected]
>> http://groups.google.com/group/sdruby
>
>
>  --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
>

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to