Skip to content

Instantly share code, notes, and snippets.

@stefl
Created July 3, 2011 17:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefl/1062414 to your computer and use it in GitHub Desktop.
Save stefl/1062414 to your computer and use it in GitHub Desktop.
How to get Padrino, Compass and Heroku working without checking in the resulting css to the git repo
# Enables support for Compass, a stylesheet authoring framework based on SASS.
# See http://compass-style.org/ for more details.
# Store Compass/SASS files (by default) within 'app/stylesheets'
module CompassInitializer
def self.registered(app)
require 'sass/plugin/rack'
Compass.configuration do |config|
config.project_path = Padrino.root
config.sass_dir = "app/stylesheets"
config.project_type = :stand_alone
config.http_path = "/"
config.css_dir = "tmp/stylesheets" # we need to render to tmp
config.images_dir = "public/images"
config.javascripts_dir = "public/javascripts"
config.output_style = :compressed
end
Compass.configure_sass_plugin!
Compass.handle_configuration_change!
app.use Sass::Plugin::Rack
# then use Rack::Static to handle any requests for stylesheets and respond with the files rendered to tmp
require "fileutils"
FileUtils.mkdir_p(Padrino.root + "/tmp/stylesheets")
app.use Rack::Static, :root => "tmp/", :urls => ["/stylesheets"]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment