Is it possible to set different SASS output style for development and production with Compass in rails?
compass-sass, ruby-on-rails, sass
Solution
It appears that it's pretty easy:
output_style = RAILS_ENV == "production" ? :compressed : :nested
To check it I've run this rake task in different environments (I had to change sass source before running this task):
namespace :sass do
desc 'Updates stylesheets if necessary from their Sass templates.'
task :update => :environment do
Sass::Plugin.update_stylesheets
end
end
You can place this task in lib/tasks/sass.rake.
Else I have this task running in my Capistrano deploy.rb to automatically update stylesheets on production during deployment:
after 'deploy:restart', 'sass:update'
namespace :sass do
desc 'Updates the stylesheets generated by Sass'
task :update, :roles => :app do
invoke_command "cd #{current_release}; rake sass:update RAILS_ENV=production"
end
end
Problem
Let say I would like to set nested style for development and compressed for production. There is only one option in Compass configuration file: ``` output_style = :compact # or :nested, :expanded, :compressed ```