Class: JsDomCompiler
- Inherits:
-
DOMCompiler
- Object
- DOMCompiler
- JsDomCompiler
- Defined in:
- lib/compilers/jsDomCompiler.rb
Constant Summary
Constants included from SqweezeUtils
SqweezeUtils::EMBED_MIME_TYPES
Instance Attribute Summary
Attributes inherited from DOMCompiler
Instance Method Summary collapse
Methods inherited from DOMCompiler
#css_cdata, #get_resource, #initialize, #iterate_over, #js_cdata
Methods included from SqweezeUtils
#ansi_bold, #ansi_green, #ansi_nocolour, #ansi_red, #ansi_yellow, #byteweight, #compression_percentage, #encoded_contents, #find_file_in_targetdir, #mime_type, #notify, #remap_filepath, #write_file
Constructor Details
This class inherits a constructor from DOMCompiler
Instance Method Details
#compile ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/compilers/jsDomCompiler.rb', line 3 def compile iterate_over('script[@src]') do |element, doc | res_body=get_resource(element.get_attribute('src')) element.remove_attribute('src') # do the YUI/CLOSURE thing here element.innerHTML=js_cdata(res_body,:compress) end end |
#compress(fbody) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/compilers/jsDomCompiler.rb', line 14 def compress(fbody) unless @cm.default_js_compressor == :closure compressor, method = YUI::JavaScriptCompressor.new( :munge => true), :compress else compressor, method = Closure::Compiler.new, :compiler end compressor.send(method,fbody) end |