Created
December 15, 2010 11:57
-
-
Save mdub/741890 to your computer and use it in GitHub Desktop.
serve *.sass using Rack::File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/metal/sass_stylesheets.rb | |
# | |
# This Rails metal keeps Sass stylesheets up-to-date, and serves them using Rack. | |
# | |
# Unlike the default Sass/Rails integration, this happily supports a | |
# Sass::Plugin.options[:css_location] outside the Rails.public_path. | |
# | |
class SassStylesheets | |
class << self | |
def call(env) | |
Sass::Plugin.check_for_updates | |
sass_file_server.call(env) | |
end | |
private | |
def sass_file_server | |
stylesheets_dir = Sass::Plugin.options[:css_location] | |
@sass_file_server ||= ::Rack::File.new(File.dirname(stylesheets_dir)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment