class Malt::Engine::Sass

Sass Malt Engine

Constants

ENGINE_OPTION_NAMES

List of Sass/Scss engine options. Note that not all options are supported. Also use `:type` instead of `:syntax` and `:file` instead of `:filename`.

@see sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#options

Public Instance Methods

create_engine(params={}) click to toggle source
# File lib/malt/engines/sass.rb, line 25
def create_engine(params={})
  text, file, type = parameters(params, :text, :file, :type)

  opts = engine_options(params)

  opts[:filename] = file
  opts[:syntax]   = type

  cached(text, file, type) do
    ::Sass::Engine.new(text, opts)
  end
end
render(params={}, &content) click to toggle source
Calls superclass method Malt::Engine::Abstract#render
# File lib/malt/engines/sass.rb, line 12
def render(params={}, &content)
  into = parameters(params, :to)

  case into
  when :css, nil
    engine = prepare_engine(params)
    engine.render
  else
    super(params, &content)
  end
end

Private Instance Methods

engine_option_names() click to toggle source
# File lib/malt/engines/sass.rb, line 56
def engine_option_names
  ENGINE_OPTION_NAMES
end
require_engine() click to toggle source

Load Sass library if not already loaded.

# File lib/malt/engines/sass.rb, line 41
def require_engine
  return if defined? ::Sass::Engine
  require_library 'sass'
end