cssminify 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +5 -0
- data/lib/cssminify/cssmin.rb +10 -6
- data/lib/cssminify/version.rb +1 -1
- data/spec/tests/zeros.css +7 -1
- data/spec/tests/zeros.css.min +1 -1
- metadata +6 -6
data/CHANGES.md
CHANGED
data/lib/cssminify/cssmin.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# cssmin.rb - 1.0.
|
2
|
+
# cssmin.rb - 1.0.1
|
3
3
|
# Author: Matthias Siegel - https://github.com/matthiassiegel/cssmin
|
4
4
|
# This is a Ruby port of the CSS minification tool
|
5
5
|
# distributed with YUICompressor, based on the original Java
|
@@ -148,7 +148,7 @@ module CssCompressor
|
|
148
148
|
#
|
149
149
|
# Retain space for special IE6 cases
|
150
150
|
#
|
151
|
-
css = css.gsub(/:first-(line|letter)(\{|,)/) { ":first-#{$1.to_s} #{$2.to_s}" }
|
151
|
+
css = css.gsub(/:first-(line|letter)(\{|,)/i) { ":first-#{$1.to_s.downcase} #{$2.to_s}" }
|
152
152
|
|
153
153
|
#
|
154
154
|
# No space after the end of a preserved comment
|
@@ -180,7 +180,7 @@ module CssCompressor
|
|
180
180
|
#
|
181
181
|
# Replace 0(px,em,%) with 0
|
182
182
|
#
|
183
|
-
css = css.gsub(/([
|
183
|
+
css = css.gsub(/(^|[^0-9])(?:0?\.)?0(?:px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|m?s|k?hz)/i) { $1.to_s + '0' }
|
184
184
|
|
185
185
|
#
|
186
186
|
# Replace 0 0 0 0; with 0
|
@@ -204,7 +204,7 @@ module CssCompressor
|
|
204
204
|
# Shorten colors from rgb(51,102,153) to #336699
|
205
205
|
# This makes it more likely that it'll get further compressed in the next step.
|
206
206
|
#
|
207
|
-
css = css.gsub(/rgb\s*\(\s*([0-9,\s]+)\s*\)
|
207
|
+
css = css.gsub(/rgb\s*\(\s*([0-9,\s]+)\s*\)(\d+%)?/i) {
|
208
208
|
rgbcolors = $1.to_s.split(',')
|
209
209
|
i = 0
|
210
210
|
|
@@ -218,6 +218,10 @@ module CssCompressor
|
|
218
218
|
i += 1
|
219
219
|
end
|
220
220
|
|
221
|
+
unless $2.to_s.empty?
|
222
|
+
rgbcolors << (' ' + $2.to_s)
|
223
|
+
end
|
224
|
+
|
221
225
|
'#' + rgbcolors.join('')
|
222
226
|
}
|
223
227
|
|
@@ -234,7 +238,7 @@ module CssCompressor
|
|
234
238
|
rest = css
|
235
239
|
new_css = ''
|
236
240
|
|
237
|
-
while m = rest.match(/(\=\s*?["']?)?#([0-9a-
|
241
|
+
while m = rest.match(/(\=\s*?["']?)?#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(:?\}|[^0-9a-f{][^{]*?\})/i) do
|
238
242
|
#
|
239
243
|
# Normal color value
|
240
244
|
#
|
@@ -271,7 +275,7 @@ module CssCompressor
|
|
271
275
|
#
|
272
276
|
# border: none -> border:0
|
273
277
|
#
|
274
|
-
css = css.gsub(/(border|border-top|border-right|border-bottom|border-
|
278
|
+
css = css.gsub(/(border|border-top|border-right|border-bottom|border-left|outline|background):none(;|\})/i) { "#{$1.to_s.downcase}:0#{$2.to_s}" }
|
275
279
|
|
276
280
|
#
|
277
281
|
# Shorter opacity IE filter
|
data/lib/cssminify/version.rb
CHANGED
data/spec/tests/zeros.css
CHANGED
@@ -2,5 +2,11 @@ a {
|
|
2
2
|
margin: 0px 0pt 0em 0%;
|
3
3
|
_padding-top: 0ex;
|
4
4
|
background-position: 0 0;
|
5
|
-
padding: 0in 0cm 0mm 0pc
|
5
|
+
padding: 0in 0cm 0mm 0pc;
|
6
|
+
transition: opacity .0s;
|
7
|
+
transition-delay: 0.0ms;
|
8
|
+
transform: rotate3d(0grad, 0rad, 0deg);
|
9
|
+
pitch: 0khz;
|
10
|
+
pitch:
|
11
|
+
0hz /* intentionally on next line */;
|
6
12
|
}
|
data/spec/tests/zeros.css.min
CHANGED
@@ -1 +1 @@
|
|
1
|
-
a{margin:0;_padding-top:0;background-position:0 0;padding:0}
|
1
|
+
a{margin:0;_padding-top:0;background-position:0 0;padding:0;transition:opacity 0;transition-delay:0;transform:rotate3d(0,0,0);pitch:0;pitch:0}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cssminify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
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-06-
|
12
|
+
date: 2012-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2161788620 !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: *
|
24
|
+
version_requirements: *2161788620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &2161787120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '1.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2161787120
|
36
36
|
description: ! ' The CSSminify gem provides CSS compression using YUI compressor.
|
37
37
|
Instead of wrapping around the Java or Javascript version of YUI compressor it uses
|
38
38
|
a native Ruby port of the CSS engine. Therefore this gem has no dependencies except
|