8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/reduce.rb', line 8
def reduce(file)
extension = File.extname(file).downcase.sub('.','')
case extension
when 'html', 'xml'
compressor = File.join(File.dirname(__FILE__),'..','vendor','htmlcompressor*.jar')
`java -jar #{compressor} --type #{extension} --compress-js --compress-css #{file}`
when 'js','css'
compressor = File.join(File.dirname(__FILE__),'..','vendor','yuicompressor*.jar')
`java -jar #{compressor} --type #{extension} #{file}`
when 'jpg', 'jpeg', 'png', 'gif'
reduce_image file
else
raise "reduce does not know how to handle a .#{extension} file (#{file})"
end
end
|