简体   繁体   中英

How do I make Rails 3.1 concatenate assets in development mode?

I am having trouble getting the asset pipeline to concatenate (but not compress!) assets in development. The idea is that I can stop making 70+ requests for tiny css/js files for every development page load, but still get to view a line number so I can figure out where problems are.

My config/environments/development.rb has this, which I interpret the rails guide to mean that assets should be compiled into one file, but not compressed:

config.assets.compress = false
config.assets.compile = true
config.assets.digest = false
config.assets.debug = false

But no dice: assets are still served individually instead of concatenated within application.js.

Any help would be appreciated!

Try to add debug: false to your include/link-tags

# in views/layouts/application.html.haml (or .erb, then use <%= %>)
= stylesheet_link_tag    "application", debug: false
= javascript_include_tag "application", debug: false

No need to restart app! I hope you didn't forget to do it after you had changed your development.rb ;-).

Tell if it works for you (because your settings made my development mode to concatenate js/css-files easy).

Only as temporary solution, of course.

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