Module: Erector::Sass
- Included in:
- HTMLWidget, Widget
- Defined in:
- lib/erector/sass.rb
Overview
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.
Instance Method Summary collapse
Instance Method Details
#sass(arg, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/erector/sass.rb', line 12 def sass(arg, = {}) require "sass" = {:cache => false}.merge() if arg =~ /[\w\.*]\.s?css/i [:filename] = arg sass_text = File.read(arg) else sass_text = arg end style raw(::Sass.compile(sass_text, )) end |
#scss(arg, options = {}) ⇒ Object
24 25 26 |
# File 'lib/erector/sass.rb', line 24 def scss(arg, = {}) sass arg, {:syntax => :scss}.merge() end |