Sha256: 2587938d69746df6d4ef49dd7e09af6cc3fa4bc08cb2504a737d4cdb7c7e23f8
Contents?: true
Size: 718 Bytes
Versions: 1
Compression:
Stored size: 718 Bytes
Contents
module HtmlUglifier class Compressor def initialize() @compressor = File.join(File.dirname(__FILE__), '..', 'vendor', 'htmlcompressor*.jar') end def compress(html) temp_file = File.join(File.dirname(__FILE__), '..', 'temp', 'temp.html') File.open(temp_file, 'w') { |f| f.write(html) } `java -jar #{path @compressor} --type html --compress-js --compress-css #{path temp_file}; rm #{path temp_file}` end def compress_file(input_file, output_file) minified_html = `java -jar #{path @compressor} --type html --compress-js --compress-css #{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.1 | lib/html_uglifier.rb |