I am currently using Compass with Heroku, using this configuration recommended in the Heroku Knowledge Base. Heroku has a read-only file system, so compiled style sheets need to be stored in / tmp. This works great on Heroku; locally, however, Rails expects to find stylesheets in / public / stylesheets (when called through = stylesheet_link_tag 'screen.css', :media => 'screen, projection').
To solve the problem, I created symbolic links in / public / stylesheets using ln -s tmp/stylesheets/screen.css public/stylesheets/screen.cssand it seems to work.
Is there a way to solve this problem without using symbolic links, perhaps by changing some configuration in Rails? I poked without much success.
Here is my config / initializers / compass.rb:
require 'compass'
require 'compass/app_integration/rails'
Compass::AppIntegration::Rails.initialize!
require 'fileutils'
FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets"))
Compass::AppIntegration::Rails.initialize!
Rails.configuration.middleware.delete('Sass::Plugin::Rack')
Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Sass::Plugin::Rack')
Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Rack::Static',
:urls => ['/stylesheets'],
:root => "#{Rails.root}/tmp")
And here is my config / compass.rb:
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
http_path = "/"
css_dir = 'tmp/stylesheets'
sass_dir = 'app/views/stylesheets'
environment = Compass::AppIntegration::Rails.env
.