Sha256: 1427a830d7664a44a40296c0193540365f350f8f5c603ee7dba69ed2751abae2
Contents?: true
Size: 655 Bytes
Versions: 1
Compression:
Stored size: 655 Bytes
Contents
require 'open3' module HtmlUglifier class Compressor COMPRESSOR = File.join(File.dirname(__FILE__), '..', 'vendor', 'htmlcompressor*.jar') def initialize(options = '') @options = options end def compress(html) stdin, stdout, stderr = Open3.popen3("java -jar #{path COMPRESSOR} --type html #{@options}") stdin.puts html stdin.close stdout.gets end def compress_file(input_file, output_file) minified_html = `java -jar #{path COMPRESSOR} --type html #{@options} #{path input_file}` File.open(output_file, 'w') { |f| f.write(minified_html) } end private def path(path) path.gsub(' ', '\ ') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
html_uglifier-0.1.2 | lib/html_uglifier.rb |