Method: JsCompressor#process

Defined in:
lib/compressors/jsCompressor.rb

#process(input_str, cmd = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/compressors/jsCompressor.rb', line 9

def process(input_str,cmd=nil)
 if @cm.get_conf(:default_js_compressor) == :closure
      compressor, method = Closure::Compiler.new, :compiler
 else
      compressor, method = YUI::JavaScriptCompressor.new( :munge => true), :compress
 end
 fout= (@concatenate_input)? "#{@cm.target_dir}/javascripts.min.js" : @cm.get_target_path(inputpath)
 

 File.open(fout,'w') do |f|
    f.write(compressor.send( method, input_str))
 end

 # set the total byte-weight 
 @byteweight_after=byteweight(fout) 
 fout
end