Class: Crush::YUI::CssCompressor

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

Overview

Engine implementation the YUI CSS compressor. See:

rubygems.org/gems/yui-compressor

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)


37
38
39
# File 'lib/crush/yui.rb', line 37

def self.engine_initialized?
  !!(defined?(::YUI) && defined?(::YUI::CssCompressor))
end

Instance Method Details

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



50
51
52
# File 'lib/crush/yui.rb', line 50

def evaluate(scope, locals, &block)
  @output ||= @engine.compress(data)
end

#initialize_engineObject



41
42
43
# File 'lib/crush/yui.rb', line 41

def initialize_engine
  require_template_library "yui/compressor"
end

#prepareObject



45
46
47
48
# File 'lib/crush/yui.rb', line 45

def prepare
  @engine = ::YUI::CssCompressor.new(options)
  @output = nil
end