Method: Yui.compress

Defined in:
lib/scms/yui.rb

.compress(asset, ext) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/scms/yui.rb', line 14

def Yui.compress(asset, ext)
    if File.exists?(asset)
        #ScmsUtils.log( " Encoding: #{asset.encoding}" )
        enc = "--charset utf-8"
        enc = ""
        cmd = "java"
        params = "-jar \"#{File.join(Folders[:assets], "yuicompressor", "yuicompressor-2.4.7.jar")}\"  #{enc} --type #{ext.gsub(".","")} \"#{asset}\" -o \"#{asset}\""
        ##Need to check if asset exists
        if system("#{cmd} #{params}")
            ScmsUtils.log( "_Crunched #{File.basename(asset)}_" )
        else
            ScmsUtils.errLog( "Error crunching: #{asset}" )
        end
    else
        ScmsUtils.errLog( "#{asset} does not exist" )
    end
end