Class: Sinatra::AssetPack::YuiEngine

Inherits:
Engine
  • Object
show all
Defined in:
lib/sinatra/assetpack/engines/yui.rb

Instance Method Summary collapse

Methods inherited from Engine

#sys

Constructor Details

#initializeYuiEngine

Returns a new instance of YuiEngine.



3
4
5
# File 'lib/sinatra/assetpack/engines/yui.rb', line 3

def initialize
  require 'yui/compressor'
end

Instance Method Details

#css(str, options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/sinatra/assetpack/engines/yui.rb', line 13

def css(str, options={})
  YUI::CssCompressor.new.compress(str)
rescue Errno::ENOENT
  nil
end

#js(str, options = {}) ⇒ Object



7
8
9
10
11
# File 'lib/sinatra/assetpack/engines/yui.rb', line 7

def js(str, options={})
  YUI::JavaScriptCompressor.new(options).compress(str)
rescue LoadError
  nil
end