Sha256: c8199565095e14c58fb48140c0bdcc2dd2d05d410b48e8d853ac80d0caebe346

Contents?: true

Size: 808 Bytes

Versions: 1

Compression:

Stored size: 808 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'optparse'
require 'reduce'

options = {}
OptionParser.new do |opts|
  opts.banner = <<BANNER
Lossless optimize js, css, html, xml, jpg, png, gif

Usage:
    reduce -o public/image.gif
    reduce public/javascripts/application.js > public/javascripts/application.min.js

Options are:
BANNER
  opts.on("-o", "--overwrite", "overwrite file") { options[:overwrite]=true }
  opts.on('-v', '--version', 'Show Version'){ puts Reduce::VERSION; exit}
  opts.on("-h", "--help", "Show this.") { puts opts; exit }
end.parse!

file = ARGV.first
if file.to_s.empty? or not File.exist?(file)
  puts "Usage instructions: reduce --help"
  exit
else
  data = Reduce.reduce(file)
  if options[:overwrite]
    File.open(file, 'w'){|f| f.print data}
  else
    print data
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reduce-0.3.0 bin/reduce