Ruby on Rails Thursday, December 29, 2011

On Thu, 2011-12-29 at 18:30 -0700, Ralph Shnelvar wrote:
> Thursday, December 29, 2011, 4:26:30 PM, you wrote:

> CW> ----
> CW> I gather that including 'application.js' in your template is what causes all the files in app/assets/javascripts to be loaded in alphabetic order - at least, that was my conclusion but I think
> CW> that was with Rails 3.1.1 and now I am on 3.1.3 and it seems to do the same... also the css files in app/assets/stylesheets which forced me to rename my main css file to zlayout.css
>
> CW> I rather like the ability to have snippets of javascript and css in separate files while in development mode as that allows portability but the alphabetic loading threw me for a while and I finally figured out that at least the order is predictable (which is important with css)
>
> CW> It would seem if you want to manhandle the load order of scripts in assets then you probably should not include application.js and include those you specifically want in your layout but then you
> CW> are going to have make manual adjustments when it comes to deploying (as opposed to simply executing 'bundle exec rake assets:precompile')
>
> CW> Craig
>
> Thank you.
>
> Now that I know someone else is seeing this crazy behavior, I'll dig into the code and see if I can turn it off and have it act reasonably.
----
Martin explained it...

In app/assets/javascripts/application.js, the line...

//=require_tree

causes it to auto-load the other files in the same directory.

That said, I would suggest that you learn to swim with the tide and make
it work to your advantage rather than override the default behavior.

Craig


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment