D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
td-agent
/
embedded
/
lib
/
ruby
/
gems
/
2.1.0
/
gems
/
sprockets-2.12.4
/
lib
/
sprockets
/
Filename :
yui_compressor.rb
back
Copy
require 'tilt' module Sprockets class YUICompressor < Tilt::Template def self.engine_initialized? defined?(::YUI) end def initialize_engine require_template_library 'yui/compressor' end def prepare end 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 end end