Sha256: 88080c069fb6082404f2c2d0a79d98c98582ddae744ab103f2bd6b55992daeec
Contents?: true
Size: 903 Bytes
Versions: 1
Compression:
Stored size: 903 Bytes
Contents
require 'optparse' require 'fileutils' require 'css_inliner' opt = OptionParser.new Version = CSSInliner::VERSION options = {} opt.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options] htmlfile" opt.on('-o', '--output=OUTPUTFILE', 'file name to output result HTML') {|v| options[:output] = v} opt.on('-i [SUFFIX]', '--in-place', '--overwrite', 'inplace editing') do |v| options[:'in-place'] = true options[:suffix] = v end opt.on('-e ELEMENT', '--element', 'element name to extract as root') {|v| options[:element] = v} opt.parse! ARGV processed = CSSInliner.process File.read(ARGV[0]), File.dirname(ARGV[0]), options[:element] if options[:'in-place'] FileUtils.cp(ARGV[0], ARGV[0] + options[:suffix]) if options[:suffix] File.open(ARGV[0], 'w') {|f| f.write processed} elsif options[:output] File.open(options[:output], 'w') {|f| f.write processed} else $stdout.write processed end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
css_inliner-0.2.0 | bin/css-inliner |