Sha256: 53af947db2d399a0eb184a7944d08167aef914b9361bb91ebbd0b02af39b5893
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
require 'optparse' require 'fileutils' require 'css_inliner' opt = OptionParser.new Version = CSSInliner::VERSION options = {format: 'html'} 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('-f', '--format=FORMAT', 'format to output("html", "xhtml" or "xml")', %w[html xhtml xml]) {|v| options[:format] = 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], options[:format] 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
css_inliner-0.3.2 | bin/css-inliner |
css_inliner-0.3.1 | bin/css-inliner |
css_inliner-0.3.0 | bin/css-inliner |
css_inliner-0.2.1 | bin/css-inliner |