Skip to content

Instantly share code, notes, and snippets.

@icambron
Created August 14, 2011 09:40
Show Gist options
  • Select an option

  • Save icambron/1144745 to your computer and use it in GitHub Desktop.

Select an option

Save icambron/1144745 to your computer and use it in GitHub Desktop.
deawkwarding?
def scss(template, options = {}, locals = {})
options, engine = Overrides.render_options(template, options, :scss)
super(template, options, locals)
end
def sass(template, options = {}, locals = {})
options, engine = Overrides.render_options(template, options, :sass)
super(template, options, locals)
end
def stylesheet(template, options = {}, locals = {})
options, engine = Overrides.render_options(template, options, :sass, :scss)
send(engine, template, options, locals)
end
and later
def self.render_options(template, options, *engines)
if options.key?(:views) and engines.length == 1
[options, engines.first]
else
[local_view_path, theme_view_path].each do |path|
engines.each do |engine|
if template_exists?(engine, path, template)
return [{:views => path}.merge(options), engine]
end
end
end
[options, nil]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment