Created
December 1, 2011 15:38
-
-
Save sj26/1417639 to your computer and use it in GitHub Desktop.
This file contains 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
# Adds SASS rendering support to Rails actionview (from controllers) | |
module Sass::Rails::Views | |
class Railtie < ::Rails::Railtie | |
initializer "sass-rails-views" do | |
# Tell ActionView we can handle SASS templates | |
ActionView::Template.register_template_handler :sass, Sass::Rails::Views::Template | |
end | |
# Create a SASS file as a rails template | |
class Template | |
class_attribute :default_format | |
self.default_format = Mime::CSS | |
def self.call template | |
"Sass::Rails::SassTemplate.new { #{template.inspect} }.render Rails.application.assets.context_class.new(Rails.application.assets, '', Rails.application.assets.root)" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment