Created
October 13, 2010 21:36
-
-
Save stouset/624962 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
class ActionView::Template::Handlers::Sass < ActionView::Template::Handler | |
include ActionView::Template::Handlers::Compilable | |
def compile(template) | |
engine = Sass::Engine.new template.source, options(template) | |
<<-VCJMIOEP | |
<<-QCGQCEWG | |
#{engine.render} | |
QCGQCEWG | |
VCJMIOEP | |
end | |
def syntax(filename) | |
case filename | |
when %r{\.scss$} then :scss | |
when %r{\.sass$} then :sass | |
end | |
end | |
def options(template) | |
Sass::Plugin.engine_options :syntax => syntax(template.identifier) | |
end | |
def handles_encoding? | |
true | |
end | |
end | |
ActionView::Template.register_template_handler :sass, | |
ActionView::Template::Handlers::Sass | |
ActionView::Template.register_template_handler :scss, | |
ActionView::Template::Handlers::Sass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment