Adds sass support to Erector widgets.
Sass is an *optional dependency* of the Erector gem, so a call to sass
inside a widget will fail unless you have already installed the sass gem
(e.g. "gem 'sass'" in your code or Gemfile).
Current support is barebones. Please offer suggestions (or better yet, patches) for whether and how to support, e.g., caching, loading from files, precompilation, etc.
# File lib/erector/sass.rb, line 12 def sass(arg, options = {}) require "sass" options = {:cache => false}.merge(options) if arg =~ %r[\w\.*]\.s?css/ options[:filename] = arg sass_text = File.read(arg) else sass_text = arg end style raw(::Sass.compile(sass_text, options)) end
# File lib/erector/sass.rb, line 24 def scss(arg, options = {}) sass arg, {:syntax => :scss}.merge(options) end