Search code examples
rubyherokucompass-sasspadrino

Padrino, compass and heroku's read-only file-system


I really like the way padrino 'just works' with compass but I have a few questions as I'm going to be using heroku (and their read-only file-system) for hosting

  1. From the looks of things, the padrino/compass combo only compiles sass if changes have been made to the sass file and a user hits the server. Is that true?

  2. If so, then am I right in thinking that I won't have to worry about compass trying to write to the file-system once the app is in production mode since I won't be making any changes to my sass files when they are on the server?

  3. Are there any other situations, other than changes being made to the sass files, that will cause padrino/compass to write to the file-system?

  4. If the assumption I make in question 2 is wrong , then how can I prevent padrino/compass from writing to the file-system?

Nathan Weizenbaum (of Sass fame) advised me to use Sass::Plugin::Rack, when combining sinatra, sass, compass and heroku, but after much thought, I decided that the best option (for my needs at least) was to prevent sass from doing any kind of server-side compilation by linking to my static css files without invoking sass in my routes

I notice that compass_plugin.rb (created by the padrino generator) requires "Sass:Plugin::Rack"

I won't be able to push to heroku until tomorrow night so I'm trying to get a heads up on any problems that I might encounter

[I will ask the same question on the padrino mailing]


Solution

  • Got an answer on the padrino mailing list that fixes this problem

    if Padrino.env == :production
       Sass::Plugin.options[:never_update] = true
    end
    
    # right before
    Compass.configure_sass_plugin!
    Compass.handle_configuration_change! 
    

    It works for me