html_press 0.0.4 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - jruby-18mode
7
+ - rbx-18mode
8
+ # - jruby-19mode
9
+ # - rbx-19mode
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ [:build, :install, :release].each do |task_name|
4
+ Rake::Task[task_name].prerequisites << :spec
5
+ end
6
+
7
+ require "rspec/core/rake_task"
8
+ RSpec::Core::RakeTask.new
9
+
10
+ task :default => :spec
data/Readme.md CHANGED
@@ -1,7 +1,7 @@
1
1
  #html_press
2
2
 
3
3
  ## how it works
4
-
4
+
5
5
  Remove all whitespace junk. Leave only HTML
6
6
 
7
7
  ```
@@ -36,7 +36,7 @@ module Jekyll
36
36
  def render(context)
37
37
  text = super
38
38
  before = text.bytesize
39
- text = HtmlPress.compress text
39
+ text = HtmlPress.press text
40
40
  after = text.bytesize
41
41
 
42
42
  self.class.total_economy += before - after
@@ -68,6 +68,25 @@ bundle install
68
68
  bundle exec jekyll
69
69
  ```
70
70
 
71
+ ## Additional tools
72
+
73
+ - https://github.com/aberant/css-spriter
74
+ - https://github.com/sstephenson/sprockets
75
+ - https://github.com/documentcloud/jammit
76
+ - https://github.com/cjohansen/juicer
77
+ - https://github.com/alexdunae/w3c_validators
78
+
79
+ ## TODO
80
+
81
+ - check if all utf-8 symbols, are smaller than html entities
82
+ - ambigious ampersands
83
+ - bin
84
+ - Support other minifiers (Closure, YUI compressor)
85
+ - htmlTydi
86
+ - add examples of usage with Sinatra and Rails
87
+ - https://github.com/gfranco/jeanny
88
+ - https://github.com/aanand/deadweight
89
+
71
90
  ## Alternatives
72
91
 
73
92
  ###Ruby
@@ -80,11 +99,3 @@ bundle exec jekyll
80
99
  - http://code.google.com/p/htmlcompressor/
81
100
  - smarty `strip` tag
82
101
  - W3 total cache (WP plugin from smashingmagazine contains html minifier)
83
-
84
- ## TODO
85
-
86
- - options
87
- - bin
88
- - Support other minifiers (Closure, YUI compressor)
89
- - htmlTydi
90
- - add examples of usage with Sinatra and Rails
data/html_press.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency "rspec"
24
24
  s.add_development_dependency "rake"
25
25
 
26
- s.add_runtime_dependency "rainpress"
26
+ s.add_runtime_dependency "css_press"
27
27
  s.add_runtime_dependency "uglifier"
28
28
  s.add_runtime_dependency "htmlentities"
29
29
  end
@@ -0,0 +1,21 @@
1
+ module HtmlPress
2
+ begin
3
+ require 'css_press'
4
+ def self.css_compressor (text)
5
+ text = "a{#{text}}"
6
+ text = CssPress.press text
7
+ text.gsub(/^a\{/, '').gsub!(/\}$/, '')
8
+ end
9
+ def self.style_compressor (text)
10
+ CssPress.press text
11
+ end
12
+ rescue LoadError => e
13
+ def self.css_compressor (text)
14
+ text
15
+ end
16
+ def self.style_compressor (text)
17
+ text
18
+ end
19
+ end
20
+
21
+ end
@@ -1,19 +1,25 @@
1
1
  module HtmlPress
2
2
  class Html
3
3
 
4
- def initialize (options = nil)
5
- @options = options
4
+ DEFAULTS = {
5
+ :logger => false,
6
+ :unquoted_attributes => false,
7
+ :dump_empty_values => false
8
+ }
9
+
10
+ def initialize (options = {})
11
+ @options = DEFAULTS.merge(options)
6
12
  end
7
13
 
8
14
  def log (text)
9
- if !@options.nil? && @options[:logger]
10
- @options[:logger].warn text
15
+ if @options[:logger] && @options[:logger].respond_to?(:call)
16
+ @options[:logger].call text
11
17
  end
12
18
  end
13
19
 
14
- def compile (html)
20
+ def press (html)
15
21
 
16
- out = html + ""
22
+ out = html.respond_to?(:read) ? html.read : html.dup
17
23
 
18
24
  @replacement_hash = 'MINIFYHTML' + Time.now.to_i.to_s
19
25
  @placeholders = []
@@ -46,7 +52,7 @@ module HtmlPress
46
52
  m.gsub!(/^\s+|\s+$/, '')
47
53
  css = m.gsub(/\s*<style\b[^>]*?>([\s\S]*?)<\/style>\s*/i, "\\1")
48
54
  begin
49
- css_compressed = HtmlPress.css_compressor css
55
+ css_compressed = HtmlPress.style_compressor css
50
56
  m.gsub!(css, css_compressed)
51
57
  rescue Exception => e
52
58
  log e.message
@@ -80,7 +86,6 @@ module HtmlPress
80
86
  end
81
87
 
82
88
  # trim each line.
83
- # @todo take into account attribute values that span multiple lines.
84
89
  out.gsub!(/^\s+|\s+$/m, '')
85
90
 
86
91
  re = '\\s+(<\\/?(?:area|base(?:font)?|blockquote|body' +
@@ -218,15 +223,38 @@ module HtmlPress
218
223
  value_original.gsub!(/^\s+|\s+$/, "")
219
224
  end
220
225
 
221
- # if name == "onclick"
222
- # value = HtmlPress.js_compressor value
223
- # end
226
+ events = %w[onfocus onblur onselect onchange onclick
227
+ ondblclick onmousedown onmouseup onmouseover onmousemove
228
+ onmouseout onkeypress onkeydown onkeyup]
229
+
230
+ if events.include? name
231
+ value_original.gsub! /^javascript:\s+/, ''
232
+ value_original = HtmlPress.js_compressor value_original
233
+ if delimiter == "\""
234
+ value_original.gsub! "\"", "'"
235
+ end
236
+ end
237
+
238
+ if value_original.size == 0
239
+ #attribute without value may be dropped by IE7
240
+ if @options[:dump_empty_values]
241
+ attribute = name_original
242
+ else
243
+ attribute = name_original + "=" + delimiter + delimiter
244
+ end
245
+ elsif @options[:unquoted_attributes] && !(value_original =~ /[ \t\r\n\f"'`=<>]/)
246
+ attribute = name_original + "=" + value_original
247
+ else
248
+ attribute = name_original + "=" + delimiter + value_original + delimiter
249
+ end
224
250
 
225
- attribute = name_original + "=" + delimiter + value_original + delimiter
226
251
  end
227
252
 
228
253
  attribute
229
254
  end
230
255
 
256
+ # for backward compatibility
257
+ alias :compile :press
258
+
231
259
  end
232
260
  end
@@ -1,3 +1,3 @@
1
1
  module HtmlPress
2
- VERSION = "0.0.4"
2
+ VERSION = "0.6.4"
3
3
  end
data/lib/html_press.rb CHANGED
@@ -1,11 +1,17 @@
1
1
  require "html_press/version"
2
- require "html_press/rainpress"
2
+ require "html_press/css_press"
3
3
  require "html_press/uglifier"
4
4
  require "html_press/html_entities"
5
5
  require "html_press/html"
6
6
 
7
7
  module HtmlPress
8
- def self.compress(text, options = nil)
9
- self::Html.new(options).compile text
10
- end
8
+ def self.press(text, options = {})
9
+ HtmlPress::Html.new(options).press text
10
+ end
11
+
12
+ # for backward compatibility
13
+ def self.compress(text, options = {})
14
+ HtmlPress::Html.new(options).press text
15
+ end
16
+
11
17
  end
@@ -3,12 +3,12 @@
3
3
  require_relative "../lib/html_press"
4
4
 
5
5
  class Lg
6
- attr_accessor :warns
7
- def initialize
8
- @warns = []
9
- end
10
- def warn text
11
- @warns.push text
6
+ class << self
7
+ @warns = []
8
+ attr_accessor :warns
9
+ def log text
10
+ Lg.warns.push text
11
+ end
12
12
  end
13
13
  end
14
14
 
@@ -17,144 +17,143 @@ describe HtmlPress do
17
17
  end
18
18
 
19
19
  it "should leave only one whitespace between inline tags" do
20
- HtmlPress.compress("<p>lorem <b>ipsum</b> <i>dolor</i> </p>").should eql "<p>lorem <b>ipsum</b> <i>dolor</i></p>"
20
+ HtmlPress.press("<p>lorem <b>ipsum</b> <i>dolor</i> </p>").should eql "<p>lorem <b>ipsum</b> <i>dolor</i></p>"
21
21
  end
22
22
 
23
23
  it "should leave no whitespaces between block tags" do
24
- HtmlPress.compress("<div></div> \t\r\n <div></div>").should eql "<div></div><div></div>"
25
- HtmlPress.compress("<div> <div> \t\r\n </div> </div>").should eql "<div><div></div></div>"
24
+ HtmlPress.press("<div></div> \t\r\n <div></div>").should eql "<div></div><div></div>"
25
+ HtmlPress.press("<div> <div> \t\r\n </div> </div>").should eql "<div><div></div></div>"
26
26
  end
27
27
 
28
28
  it "should leave only one whitespace in text" do
29
- HtmlPress.compress("<p>a a</p>").should eql "<p>a a</p>"
29
+ HtmlPress.press("<p>a a</p>").should eql "<p>a a</p>"
30
30
  end
31
31
 
32
32
  it "should leave newlines in pre tags and remove trailing spaces" do
33
- HtmlPress.compress("<pre>a \t </pre>").should eql "<pre>a</pre>"
34
- HtmlPress.compress("<pre>qwe \nasd </pre>").should eql "<pre>qwe\nasd</pre>"
33
+ HtmlPress.press("<pre>a \t </pre>").should eql "<pre>a</pre>"
34
+ HtmlPress.press("<pre>qwe \nasd </pre>").should eql "<pre>qwe\nasd</pre>"
35
35
  end
36
36
 
37
37
  it "should leave textareas as is" do
38
38
  text = "<textarea> \t </textarea>"
39
- HtmlPress.compress(text).should eql text
39
+ HtmlPress.press(text).should eql text
40
40
  end
41
41
 
42
42
  it "should compress js in script tags" do
43
43
  script = " (function(undefined){ \t\n var long_name = ' '; }()) \n \r"
44
- compressed_script = "<script>" + HtmlPress.js_compressor(script) + "</script>"
44
+ pressed_script = "<script>" + HtmlPress.js_compressor(script) + "</script>"
45
45
  script = " <script>" + script + "</script> "
46
- HtmlPress.compress(script).should eql compressed_script
46
+ HtmlPress.press(script).should eql pressed_script
47
47
  end
48
48
 
49
49
  it "should compress css in style tags" do
50
50
  style = " div { margin: 0px 0px; \n} "
51
- compressed_style = "<style>" + HtmlPress.css_compressor(style) + "</style>"
51
+ pressed_style = "<style>" + HtmlPress.style_compressor(style) + "</style>"
52
52
  style = " <style>" + style + "</style> "
53
- HtmlPress.compress(style).should eql compressed_style
53
+ HtmlPress.press(style).should eql pressed_style
54
54
  end
55
55
 
56
56
  it "should remove html comments" do
57
- HtmlPress.compress("<p></p><!-- comment --><p></p>").should eql "<p></p><p></p>"
57
+ HtmlPress.press("<p></p><!-- comment --><p></p>").should eql "<p></p><p></p>"
58
58
  end
59
59
 
60
60
  it "should leave IE conditional comments" do
61
61
  text = "<!--[if IE]><html class=\"ie\"><![endif]--><div></div>"
62
- HtmlPress.compress(text).should eql text
62
+ HtmlPress.press(text).should eql text
63
63
  end
64
64
 
65
65
  it "should work with special utf-8 symbols" do
66
- HtmlPress.compress("✪<p></p> <p></p>").should eql "✪<p></p><p></p>"
66
+ HtmlPress.press("✪<p></p> <p></p>").should eql "✪<p></p><p></p>"
67
67
  end
68
68
 
69
69
  it "should work with tags in upper case" do
70
- HtmlPress.compress("<P> </p>").should eql "<P></p>"
70
+ HtmlPress.press("<P> </p>").should eql "<P></p>"
71
71
  end
72
72
 
73
73
  it "should remove whitespaces between IE conditional comments" do
74
74
  text = "<p></p> <!--[if IE]><html class=\"ie\"> <![endif]--> <!--[if IE]><html class=\"ie1\"><![endif]-->"
75
75
  text2 = "<p></p><!--[if IE]><html class=\"ie\"><![endif]--><!--[if IE]><html class=\"ie1\"><![endif]-->"
76
- HtmlPress.compress(text).should eql text2
76
+ HtmlPress.press(text).should eql text2
77
77
  end
78
78
 
79
79
  it "should treat text inside IE conditional comments as it was without comments" do
80
80
  text = "<div class=\"a\" id=\"b\"> </div> <p></p>"
81
- text2 = HtmlPress.compress(text)
81
+ text2 = HtmlPress.press(text)
82
82
  text = "<!--[if IE]>" + text + "<![endif]-->"
83
83
  text2 = "<!--[if IE]>" + text2 + "<![endif]-->"
84
- HtmlPress.compress(text).should eql text2
84
+ HtmlPress.press(text).should eql text2
85
85
  text = "<script> (function(undefined){ var a;}()) </script>"
86
- text2 = HtmlPress.compress(text)
86
+ text2 = HtmlPress.press(text)
87
87
  text = "<!--[if IE]>" + text + "<![endif]-->"
88
88
  text2 = "<!--[if IE]>" + text2 + "<![endif]-->"
89
- HtmlPress.compress(text).should eql text2
89
+ HtmlPress.press(text).should eql text2
90
90
  end
91
91
 
92
92
  it "should remove unnecessary whitespaces inside tag" do
93
- HtmlPress.compress("<p class=\"a\" id=\"b\"></p>").should eql "<p class=\"a\" id=\"b\"></p>"
94
- HtmlPress.compress("<p class=\"a\" ></p>").should eql "<p class=\"a\"></p>"
95
- HtmlPress.compress("<img src=\"\" />").should eql "<img src=\"\"/>"
96
- HtmlPress.compress("<br />").should eql "<br/>"
93
+ HtmlPress.press("<p class=\"a\" id=\"b\"></p>").should eql "<p class=\"a\" id=\"b\"></p>"
94
+ HtmlPress.press("<p class=\"a\" ></p>").should eql "<p class=\"a\"></p>"
95
+ HtmlPress.press("<img src=\"\" />").should eql "<img src=\"\"/>"
96
+ HtmlPress.press("<br />").should eql "<br/>"
97
97
  end
98
98
 
99
99
  it "should work with 'badly' formatted attributes" do
100
- HtmlPress.compress("<p class='a' id='b'></p>").should eql "<p class='a' id='b'></p>"
101
- # HtmlPress.compress("<p class = 'a'></p>").should eql "<p class='a'></p>"
102
- # HtmlPress.compress("<p class = a></p>").should eql "<p class=a></p>"
100
+ HtmlPress.press("<p class='a' id='b'></p>").should eql "<p class='a' id='b'></p>"
101
+ # HtmlPress.press("<p class = 'a'></p>").should eql "<p class='a'></p>"
102
+ # HtmlPress.press("<p class = a></p>").should eql "<p class=a></p>"
103
103
  end
104
104
 
105
105
  it "should optimize attributes" do
106
- HtmlPress.compress("<p class=\"a b\"></p>").should eql "<p class=\"a b\"></p>"
106
+ HtmlPress.press("<p class=\"a b\"></p>").should eql "<p class=\"a b\"></p>"
107
107
  # http(s):// to //
108
108
  end
109
109
 
110
110
  it "should compress css in style attributes" do
111
- HtmlPress.compress("<p style=\"display: none;\"></p>").should eql "<p style=\"display:none;\"></p>"
111
+ HtmlPress.press("<p style=\"display: none;\"></p>").should eql "<p style=\"display:none\"></p>"
112
112
  end
113
113
 
114
114
  it "should work with namespaces" do
115
115
  text = "<html xmlns:og=\"http://ogp.me/ns#\" class=\"a b\"><og:like>like</og:like></html>"
116
- HtmlPress.compress(text).should eql text
116
+ HtmlPress.press(text).should eql text
117
117
  end
118
118
 
119
119
  it "should not modify input value" do
120
- text = "<div> </div>"
121
- text1 = text + ""
122
- HtmlPress.compress(text)
120
+ text = "<div> </div>"
121
+ text1 = text.dup
122
+ HtmlPress.press(text).should_not eql text
123
123
  text.should eql text1
124
124
  end
125
125
 
126
126
  it "should leave whitespaces inside other attributes" do
127
127
  text = "<a onclick=\"alert(' ')\" unknown_attr=' a a'>a</a>"
128
- HtmlPress.compress(text).should eql text
128
+ HtmlPress.press(text).should eql text
129
129
  end
130
130
 
131
131
  it "should report javascript errors" do
132
132
  script_with_error = "<script>function(){</script>"
133
- l = Lg.new
134
- l.warns.size.should eql 0
135
- HtmlPress.compress(script_with_error, {:logger => l}).should eql script_with_error
136
- l.warns.size.should eql 1
133
+ Lg.warns = []
134
+ HtmlPress.press(script_with_error, {:logger => Lg.method(:log)}).should eql script_with_error
135
+ Lg.warns.size.should eql 1
137
136
  end
138
137
 
139
138
  # it "should report css errors" do
140
139
  # script_with_error = "<style>.clas{margin:</style>"
141
140
  # l = Lg.new
142
141
  # l.warns.size.should eql 0
143
- # HtmlPress.compress(script_with_error, {:logger => l}).should eql script_with_error
142
+ # HtmlPress.press(script_with_error, {:logger => l}).should eql script_with_error
144
143
  # l.warns.size.should eql 1
145
144
  # end
146
145
 
147
146
  it "should remove values of boolean attributes" do
148
- HtmlPress.compress("<option selected=\"selected\">a</option>").should eql "<option selected>a</option>"
149
- HtmlPress.compress("<input type=\"checkbox\" checked=\"checked\"/>").should eql "<input type=\"checkbox\" checked/>"
150
- HtmlPress.compress("<input type=\"radio\" checked=\"checked\"/>").should eql "<input type=\"radio\" checked/>"
147
+ HtmlPress.press("<option selected=\"selected\">a</option>").should eql "<option selected>a</option>"
148
+ HtmlPress.press("<input type=\"checkbox\" checked=\"checked\"/>").should eql "<input type=\"checkbox\" checked/>"
149
+ HtmlPress.press("<input type=\"radio\" checked=\"checked\"/>").should eql "<input type=\"radio\" checked/>"
151
150
  # disabled (input, textarea, button, select, option, optgroup)
152
- HtmlPress.compress("<input disabled=\"disabled\"/>").should eql "<input disabled/>"
151
+ HtmlPress.press("<input disabled=\"disabled\"/>").should eql "<input disabled/>"
153
152
  # readonly (input type=text/password, textarea)
154
- HtmlPress.compress("<input readonly=\"readonly\"/>").should eql "<input readonly/>"
155
- # HtmlPress.compress("<script src=\"example.com\" async=\"async\"></script>").should eql "<script src=\"example.com\" async></script>"
156
- # HtmlPress.compress("<script src=\"example.com\" defer=\"defer\"></script>").should eql "<script src=\"example.com\" async></script>"
157
- # HtmlPress.compress("<select multiple=\"multiple\"/>").should eql "<select multiple/>"
153
+ HtmlPress.press("<input readonly=\"readonly\"/>").should eql "<input readonly/>"
154
+ # HtmlPress.press("<script src=\"example.com\" async=\"async\"></script>").should eql "<script src=\"example.com\" async></script>"
155
+ # HtmlPress.press("<script src=\"example.com\" defer=\"defer\"></script>").should eql "<script src=\"example.com\" async></script>"
156
+ # HtmlPress.press("<select multiple=\"multiple\"/>").should eql "<select multiple/>"
158
157
  # ismap isMap (img, input type=image)
159
158
  # declare (object; never used)
160
159
  # noresize noResize (frame)
@@ -164,38 +163,56 @@ describe HtmlPress do
164
163
  end
165
164
 
166
165
  it "should remove attributes with default values" do
167
- # HtmlPress.compress("<script type=\"text/javascript\" language=\"JavaScript\">var a;</script>").should eql "<script>var a;</script>"
168
- # HtmlPress.compress("<style type=\"text/stylesheet\"></style>").should eql "<style></style>"
169
- HtmlPress.compress("<link type=\"text/stylesheet\"/>").should eql "<link/>"
170
- HtmlPress.compress("<form method=\"get\"></form>").should eql "<form></form>"
171
- HtmlPress.compress("<input type=\"text\"/>").should eql "<input/>"
166
+ # HtmlPress.press("<script type=\"text/javascript\" language=\"JavaScript\">var a;</script>").should eql "<script>var a;</script>"
167
+ # HtmlPress.press("<style type=\"text/stylesheet\"></style>").should eql "<style></style>"
168
+ HtmlPress.press("<link type=\"text/stylesheet\"/>").should eql "<link/>"
169
+ HtmlPress.press("<form method=\"get\"></form>").should eql "<form></form>"
170
+ HtmlPress.press("<input type=\"text\"/>").should eql "<input/>"
172
171
  # input value "" ?
173
172
  end
174
173
 
175
174
  it "should convert html entities to utf-8 symbols" do
176
- HtmlPress.compress("&lt; &#60; &gt; &#62; &amp; &#38;").should eql "&lt; &#60; &gt; &#62; &amp; &#38;"
177
- HtmlPress.compress("&eacute;lan").should eql "élan"
178
- end
179
-
180
- # it "should compress javascript in event attributes" do
181
- # # javascript: - remove
182
- # # onfocus
183
- # # onblur
184
- # # onselect
185
- # # onchange
186
- # # onclick
187
- # # ondblclick
188
- # # onmousedown
189
- # # onmouseup
190
- # # onmouseover
191
- # # onmousemove
192
- # # onmouseout
193
- # # onkeypress
194
- # # onkeydown
195
- # # onkeyup
196
- # end
197
- #
198
- # it "should remove unnecessary quotes for attributes values" do
199
- # end
175
+ HtmlPress.press("&lt; &#60; &gt; &#62; &amp; &#38;").should eql "&lt; &#60; &gt; &#62; &amp; &#38;"
176
+ HtmlPress.press("&eacute;lan").should eql "élan"
177
+ end
178
+
179
+ it "should remove unnecessary quotes for attribute values" do
180
+ HtmlPress.press("<img src=\"\">", {:unquoted_attributes => true}).should eql "<img src=\"\">"
181
+ HtmlPress.press("<p id=\"a\"></p>", {:unquoted_attributes => true}).should eql "<p id=a></p>"
182
+ text = "<p id=\"a b\"></p>"
183
+ HtmlPress.press(text, {:unquoted_attributes => true}).should eql text
184
+ text = "<p id=\"a=\"></p>"
185
+ HtmlPress.press(text, {:unquoted_attributes => true}).should eql text
186
+ text = "<p id=\"a'\"></p>"
187
+ HtmlPress.press(text, {:unquoted_attributes => true}).should eql text
188
+ text = "<p id=\"a`\"></p>"
189
+ HtmlPress.press(text, {:unquoted_attributes => true}).should eql text
190
+ text = "<p id='a\"'></p>"
191
+ HtmlPress.press(text, {:unquoted_attributes => true}).should eql text
192
+ text = "<p id=\"a\t\"></p>"
193
+ HtmlPress.press(text, {:unquoted_attributes => true}).should eql text
194
+ end
195
+
196
+ it "should remove empty attribute values" do
197
+ HtmlPress.press("<img src=\"\">", {:dump_empty_values => true}).should eql "<img src>"
198
+ end
199
+
200
+ it "should compress javascript in event attributes" do
201
+ HtmlPress.press("<a onclick=\"javacript: alert(' ');\"></a>").should eql "<a onclick=\"alert(' ')\"></a>"
202
+ # onfocus
203
+ # onblur
204
+ # onselect
205
+ # onchange
206
+ # onclick
207
+ # ondblclick
208
+ # onmousedown
209
+ # onmouseup
210
+ # onmouseover
211
+ # onmousemove
212
+ # onmouseout
213
+ # onkeypress
214
+ # onkeydown
215
+ # onkeyup
216
+ end
200
217
 
201
218
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_press
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.6.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-07 00:00:00.000000000Z
12
+ date: 2012-04-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &25710912 !ruby/object:Gem::Requirement
16
+ requirement: &29725656 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *25710912
24
+ version_requirements: *29725656
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &25710636 !ruby/object:Gem::Requirement
27
+ requirement: &29725392 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *25710636
35
+ version_requirements: *29725392
36
36
  - !ruby/object:Gem::Dependency
37
- name: rainpress
38
- requirement: &25710348 !ruby/object:Gem::Requirement
37
+ name: css_press
38
+ requirement: &29725140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *25710348
46
+ version_requirements: *29725140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: uglifier
49
- requirement: &25710036 !ruby/object:Gem::Requirement
49
+ requirement: &29724876 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *25710036
57
+ version_requirements: *29724876
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: htmlentities
60
- requirement: &25709748 !ruby/object:Gem::Requirement
60
+ requirement: &29509596 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *25709748
68
+ version_requirements: *29509596
69
69
  description: Ruby gem for compressing html
70
70
  email:
71
71
  - stereobooster@gmail.com
@@ -74,14 +74,15 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - .gitignore
77
+ - .travis.yml
77
78
  - Gemfile
78
79
  - Rakefile
79
80
  - Readme.md
80
81
  - html_press.gemspec
81
82
  - lib/html_press.rb
83
+ - lib/html_press/css_press.rb
82
84
  - lib/html_press/html.rb
83
85
  - lib/html_press/html_entities.rb
84
- - lib/html_press/rainpress.rb
85
86
  - lib/html_press/uglifier.rb
86
87
  - lib/html_press/version.rb
87
88
  - spec/html_press_spec.rb
@@ -97,12 +98,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
98
  - - ! '>='
98
99
  - !ruby/object:Gem::Version
99
100
  version: '0'
101
+ segments:
102
+ - 0
103
+ hash: -37859729
100
104
  required_rubygems_version: !ruby/object:Gem::Requirement
101
105
  none: false
102
106
  requirements:
103
107
  - - ! '>='
104
108
  - !ruby/object:Gem::Version
105
109
  version: '0'
110
+ segments:
111
+ - 0
112
+ hash: -37859729
106
113
  requirements: []
107
114
  rubyforge_project: html_press
108
115
  rubygems_version: 1.8.15
@@ -1,12 +0,0 @@
1
- module HtmlPress
2
- begin
3
- require 'rainpress'
4
- def self.css_compressor (text)
5
- Rainpress.compress(text).gsub(/^\s+/m, '')
6
- end
7
- rescue LoadError => e
8
- def self.css_compressor (text)
9
- text
10
- end
11
- end
12
- end