Sha256: bbefeddf71e3178f3490b0071e4a4f03e2c4b1e9bdfa9dfce857e85289068494

Contents?: true

Size: 1.18 KB

Versions: 53

Compression:

Stored size: 1.18 KB

Contents

module Yui
    def Yui.eatall(crunchDir)
        ScmsUtils.log( "Starting crunching CSS and JavaScript in:\n#{crunchDir}\n\n" )
        Dir.chdir(crunchDir) do
            Dir.glob("**/*.{css, js}").each do |asset|
                #fullFileName = File.basename(asset)
                #ScmsUtils.log( "Crunching #{fullFileName}" )
                ext = File.extname(asset)
                Yui.compress(asset, ext)
            end
        end
    end 

    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
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
scms-4.5.1 lib/scms/yui.rb
scms-4.5.0 lib/scms/yui.rb
scms-4.4.9 lib/scms/yui.rb
scms-4.4.8 lib/scms/yui.rb
scms-4.4.6 lib/scms/yui.rb
scms-4.4.5 lib/scms/yui.rb
scms-4.4.4 lib/scms/yui.rb
scms-4.4.3 lib/scms/yui.rb
scms-4.4.2 lib/scms/yui.rb
scms-4.4.1 lib/scms/yui.rb
scms-4.4.0 lib/scms/yui.rb
scms-4.3.0 lib/scms/yui.rb
scms-4.2.6 lib/scms/yui.rb
scms-4.2.5 lib/scms/yui.rb
scms-4.2.4 lib/scms/yui.rb
scms-4.2.3 lib/scms/yui.rb
scms-4.2.2 lib/scms/yui.rb
scms-4.2.0 lib/scms/yui.rb
scms-4.1.2 lib/scms/yui.rb
scms-4.1.1 lib/scms/yui.rb