Skip to content

Instantly share code, notes, and snippets.

@ticktricktrack
Created February 8, 2011 09:48
Show Gist options
  • Save ticktricktrack/816195 to your computer and use it in GitHub Desktop.
Save ticktricktrack/816195 to your computer and use it in GitHub Desktop.
module ActionView
module Template::Handlers
class ErSass < ERB
def compile(template, local_assigns = {})
erbsrc = "<% __in_erb_template=true %>#{template.source}"
erboutput = self.class.erb_implementation.new(erbsrc, :trim => (self.class.erb_trim_mode == "-")).src
erboutput + ";Sass::Engine.new(@output_buffer.to_s, {:load_paths => ['.', 'app/stylesheets']}).render"
end
end
end
end
ActionView::Template.register_template_handler :sass, ActionView::Template::Handlers::ErSass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment