html_uglifier 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe81e53f7d2450dc9956840400f1e76ba5b51a97
4
- data.tar.gz: 6423f0208d6b1f3a3a5278e51525b8394627a8c9
3
+ metadata.gz: 7908bc238c842e04dee871963d5f81bcbeeafab9
4
+ data.tar.gz: 649064d56d40114a9d8bcc69b1347a1d2079894b
5
5
  SHA512:
6
- metadata.gz: 12bd82d015ffe1109b65b650298be7177ad0336b1b2a2de8c9d4e3b75818e00c141117acbe7f4b44b3b190892546660bb7008b8f2cd9a7ff976c0d007b06e8fe
7
- data.tar.gz: 9a4cca32bc5ace0625d811317cc35d22837e6be083d5e46c75598a104d5d468f38d4d64077c8e6aa9c84831f78bf439ca3b1af873dd14f34d34fd71271cf67f9
6
+ metadata.gz: 8b0ccfa867fda757997a6a8aee20a1b7682b3ff6b2a9e31db16734ff4302eb5a5555580892f837fde58627de338a9e84b3f8b5cc3c237e86e45aedc3930a99e7
7
+ data.tar.gz: 5444ca2bf7a4e7589870e8f67d49f345c3208951dfa563acbff7acb5d5deb418a9c6c37a491202371c99dfbfa60f95f8b743553591d75fa29662a49d9e8ca083
data/lib/html_uglifier.rb CHANGED
@@ -1,18 +1,24 @@
1
+ require 'open3'
2
+
1
3
  module HtmlUglifier
2
4
 
3
5
  class Compressor
4
- def initialize()
5
- @compressor = File.join(File.dirname(__FILE__), '..', 'vendor', 'htmlcompressor*.jar')
6
+
7
+ COMPRESSOR = File.join(File.dirname(__FILE__), '..', 'vendor', 'htmlcompressor*.jar')
8
+
9
+ def initialize(options = '')
10
+ @options = options
6
11
  end
7
12
 
8
13
  def compress(html)
9
- temp_file = File.join(File.dirname(__FILE__), '..', 'temp', 'temp.html')
10
- File.open(temp_file, 'w') { |f| f.write(html) }
11
- `java -jar #{path @compressor} --type html --compress-js --compress-css #{path temp_file}; rm #{path temp_file}`
14
+ stdin, stdout, stderr = Open3.popen3("java -jar #{path COMPRESSOR} --type html #{@options}")
15
+ stdin.puts html
16
+ stdin.close
17
+ stdout.gets
12
18
  end
13
19
 
14
20
  def compress_file(input_file, output_file)
15
- minified_html = `java -jar #{path @compressor} --type html --compress-js --compress-css #{path input_file}`
21
+ minified_html = `java -jar #{path COMPRESSOR} --type html #{@options} #{path input_file}`
16
22
  File.open(output_file, 'w') { |f| f.write(minified_html) }
17
23
  end
18
24
 
@@ -1,3 +1,3 @@
1
1
  module HtmlUglifier
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_uglifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Endri Gjiri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-14 00:00:00.000000000 Z
11
+ date: 2013-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,7 +53,6 @@ files:
53
53
  - html_uglifier.gemspec
54
54
  - lib/html_uglifier.rb
55
55
  - lib/html_uglifier/version.rb
56
- - temp/.gitkeep
57
56
  - vendor/htmlcompressor-1.5.3.jar
58
57
  - vendor/yuicompressor-2.4.6.jar
59
58
  homepage: ''
data/temp/.gitkeep DELETED
File without changes