Class: Sprockets::YUICompressor

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/sprockets/yui_compressor.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.engine_initialized?Boolean

Returns:

  • (Boolean)

5
6
7
# File 'lib/sprockets/yui_compressor.rb', line 5

def self.engine_initialized?
  defined?(::YUI)
end

Instance Method Details

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


16
17
18
19
20
21
22
23
24
25
# File 'lib/sprockets/yui_compressor.rb', line 16

def evaluate(context, locals, &block)
  case context.content_type
  when 'application/javascript'
    YUI::JavaScriptCompressor.new.compress(data)
  when 'text/css'
    YUI::CssCompressor.new.compress(data)
  else
    data
  end
end

#initialize_engineObject


9
10
11
# File 'lib/sprockets/yui_compressor.rb', line 9

def initialize_engine
  require_template_library 'yui/compressor'
end

#prepareObject


13
14
# File 'lib/sprockets/yui_compressor.rb', line 13

def prepare
end