Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Compass on Heroku: /tmp for stylesheets remotely and locally
    primarykey
    data
    text
    <p>I'm currently using Compass with Heroku using this <a href="http://devcenter.heroku.com/articles/using-compass" rel="nofollow">configuration</a> recommended on the Heroku knowledge base. Heroku has a read-only file system, and so the compiled stylesheets need to be stored in /tmp. This works fine remotely on Heroku; locally, however, Rails expects to find stylesheets in /public/stylesheets (when called through <code>= stylesheet_link_tag 'screen.css', :media =&gt; 'screen, projection'</code>).</p> <p>In order to solve the problem, I have created symbolic links in /public/stylesheets using <code>ln -s tmp/stylesheets/screen.css public/stylesheets/screen.css</code> and that seems to work.</p> <p>Is there a way to solve this problem without using symbolic links, perhaps by changing some configuration in Rails? I've poked around without much success.</p> <p>Here is my config/initializers/compass.rb:</p> <pre><code>require 'compass' require 'compass/app_integration/rails' Compass::AppIntegration::Rails.initialize! # Required for Heroku: 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 =&gt; ['/stylesheets'], :root =&gt; "#{Rails.root}/tmp") </code></pre> <p>And here is my config/compass.rb:</p> <pre><code>project_type = :rails project_path = Compass::AppIntegration::Rails.root # Set this to the root of your project when deployed: http_path = "/" # Necessary for Heroku (original commented out: css_dir = 'tmp/stylesheets' #css_dir = "public/stylesheets/compiled" sass_dir = 'app/views/stylesheets' environment = Compass::AppIntegration::Rails.env </code></pre> <p>Any help would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload