简体   繁体   中英

`application.js` no longer including all scripts in app/assets/javascripts for Rails 3.1 app

Having an issue where it appears as though application.js is no longer included all of the additional javascript scripts in the javascripts folder. This works fine in development mode, however this failure occurs in staging and production mode. It seems to only have jquery in it.

This seems to be a recent development as it was working up to a recent point that I can't put my finger on, however asset precompilation doesn't help the issue nor do I see any glaring issues in the log output, except perhaps one item:

output error : unknown encoding ASCII-8BIT

Any thoughts on tracking this down or what may be happening?

If you don't see any changes in application.js working, you may have precompiled by deploying (or otherwise) causing changes in your application.js to not actually affect your application. If this is the case, delete the stuff in your /public/assets folder.

This is just one possible solution (and I hope I'm reading your question right... you mean that application.js works but is outdated right? If not, ignore this)

Turns out that I needed to include modernizr before other js includes:

//= require jquery
//= require jquery_ujs
//= require subdirectory/modernizr
//= require_self
//= require_tree .

I'm now using a defined structure for including javascripts vs allowing the manifest to load them all up in default order based on the tree.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM