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
How to Use Gems Not in a Gemfile When Working with Bundler
How to Downgrade from Ruby 1.9.2 to Ruby 1.8.7 to Run Rails 2.0.2
Converting from Xml Name-Values into Simple Hash
Ruby Modulo 3 with Negative Numbers Is Unintuitive
Ruby Ssl Error - Sslv3 Alert Unexpected Message
Interpretation as a Local Variable Overrides Method Name
Rubygems, Bundler and Rvm Confusion
How to Make Rails 3.1 Use SASS (Over SCSS) as the Default
How to Skip Has_Secure_Password Validations
How to Use a Variable as Object Attribute in Rails
Ruby Array to JSON and Rails JSON Rendering
Building Ruby with Rbenv and Ruby-Build Fails with Undefined Symbol: Sslv2_Method