Class: Sinatra::AssetPack::ClosureEngine
- Defined in:
- lib/sinatra/assetpack/engines/closure.rb
Instance Method Summary collapse
Methods inherited from Engine
Instance Method Details
#js(str, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/sinatra/assetpack/engines/closure.rb', line 3 def js(str, ={}) require 'net/http' require 'uri' response = Net::HTTP.post_form(URI.parse('http://closure-compiler.appspot.com/compile'), { 'js_code' => str, 'compilation_level' => [:level] || "ADVANCED_OPTIMIZATIONS", 'output_format' => 'text', 'output_info' => 'compiled_code' }) response.body end |