Class: Crush::Sass::Engine

Inherits:
Engine
  • Object
show all
Defined in:
lib/crush/sass.rb

Overview

Engine implementation of the Sass::Engine CSS compressor. See:

rubygems.org/gems/sass

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :style  => :compressed,
  :syntax => :scss
}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Engine

compile, compress, #compress, #initialize, #render

Constructor Details

This class inherits a constructor from Crush::Engine

Class Method Details

.engine_initialized?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/crush/sass.rb', line 17

def self.engine_initialized?
  !!(defined?(::Sass) && defined?(::Sass::Engine))
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



29
30
31
# File 'lib/crush/sass.rb', line 29

def evaluate(scope, locals, &block)
  @output ||= ::Sass::Engine.new(data, DEFAULT_OPTIONS.dup.merge(options)).render
end

#initialize_engineObject



21
22
23
# File 'lib/crush/sass.rb', line 21

def initialize_engine
  require_template_library "sass"
end

#prepareObject



25
26
27
# File 'lib/crush/sass.rb', line 25

def prepare
  @output = nil
end