What Exactly "Config.Assets.Debug" Setting Does

config.assets.debug = true doesnt work

config.assets.compile = true

Setting should be set to true since I HAVE TO compile scss - I use SASS for stylesheet files.

Why are all of my stylesheets being included on my page when using assets pipeline?

This is the expected behavior if you are running the Rails application in the development environment (the default). By default, development is configured with config.assets.debug set to true, which causes all asset files to be served individually to ease debugging - the browser's CSS inspector will show you the correct file a rule originates from, rather than always pointing to the single generated single.

However, if you precompile and run the app in the production environment, only one file is generated and served. You can test this by running the following commands:

RAILS_ENV=production rake assets:precompile
RAILS_ENV=production rails server

If you visit your site now, you should see only a single application.css file with all of your stylesheets combined. (Make sure your config/environments/production.rb file contains config.serve_static_assets = true - otherwise, you won't get any stylesheet at al and will just see unstyled HTML.)

For more details, I recommend the section "Turning debugging off" in the Rails guide on the asset pipeline.



Related Topics



Leave a reply



Submit