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 +4 -4
- data/lib/html_uglifier.rb +12 -6
- data/lib/html_uglifier/version.rb +1 -1
- metadata +2 -3
- data/temp/.gitkeep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7908bc238c842e04dee871963d5f81bcbeeafab9
|
4
|
+
data.tar.gz: 649064d56d40114a9d8bcc69b1347a1d2079894b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
5
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
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
|
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
|
|
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.
|
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-
|
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
|