Class: Rack::Pack::Javascript
- Defined in:
- lib/rack/pack/javascript.rb
Instance Attribute Summary
Attributes inherited from Package
Instance Method Summary collapse
Methods inherited from Package
[], #compile, #compress?, #initialize, mappings, register, #source_files, #stale?, #update
Constructor Details
This class inherits a constructor from Rack::Pack::Package
Instance Method Details
#compress(source) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rack/pack/javascript.rb', line 4 def compress(source) if defined?(JSMin) JSMin.minify(source) elsif defined?(Packr) = :shrink_vars => true Packr.pack(source, ) elsif defined?(YUI) and defined?(YUI::JavaScriptCompressor) = :munge => true YUI::JavaScriptCompressor.new().compress(source) elsif defined?(Closure) and defined?(Closure::Compiler) Closure::Compiler.new().compile(source) elsif defined?(Uglifier) Uglifier.new().compile(source) else source end end |