yuicssmin 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 +10 -0
- data/README.md +3 -0
- data/lib/yuicssmin/version.rb +1 -1
- data/lib/yuicssmin.rb +4 -4
- data/spec/yuicssmin_spec.rb +5 -5
- data/yuicssmin.gemspec +1 -2
- metadata +11 -10
data/CHANGES.md
ADDED
data/README.md
CHANGED
@@ -36,6 +36,9 @@ Rails 3.1 integrated [Sprockets](https://github.com/sstephenson/sprockets) to pr
|
|
36
36
|
|
37
37
|
config.assets.css_compressor = Yuicssmin.new
|
38
38
|
|
39
|
+
## Changelog
|
40
|
+
See [CHANGES](https://github.com/matthiassiegel/yuicssmin/blob/master/CHANGES.md).
|
41
|
+
|
39
42
|
## Credits
|
40
43
|
YUICSSMIN gem was inspired by Ville Lautanala's [Uglifier](https://github.com/lautis/uglifier) gem, released under MIT license.
|
41
44
|
|
data/lib/yuicssmin/version.rb
CHANGED
data/lib/yuicssmin.rb
CHANGED
@@ -23,8 +23,8 @@ class Yuicssmin
|
|
23
23
|
#
|
24
24
|
# Compress CSS with YUI
|
25
25
|
#
|
26
|
-
# @param [String, #read] String or IO-like object that supports #read
|
27
|
-
# @param [Integer] Maximum line length
|
26
|
+
# @param [String, #read] CSS String or IO-like object that supports #read
|
27
|
+
# @param [Integer] length Maximum line length
|
28
28
|
# @return [String] Compressed CSS
|
29
29
|
def self.compress(source, length = 5000)
|
30
30
|
self.new.compress(source, length)
|
@@ -34,8 +34,8 @@ class Yuicssmin
|
|
34
34
|
#
|
35
35
|
# Compress CSS with YUI
|
36
36
|
#
|
37
|
-
# @param [String, #read] String or IO-like object that supports #read
|
38
|
-
# @param [Integer] Maximum line length
|
37
|
+
# @param [String, #read] CSS String or IO-like object that supports #read
|
38
|
+
# @param [Integer] length Maximum line length
|
39
39
|
# @return [String] Compressed CSS
|
40
40
|
def compress(source = '', length = 5000)
|
41
41
|
source = source.respond_to?(:read) ? source.read : source.to_s
|
data/spec/yuicssmin_spec.rb
CHANGED
@@ -42,14 +42,14 @@ describe "Yuicssmin" do
|
|
42
42
|
|
43
43
|
it "handles files as input format" do
|
44
44
|
lambda {
|
45
|
-
Yuicssmin.
|
45
|
+
Yuicssmin.compress(File.open(File.expand_path("../sample.css", __FILE__), "r:UTF-8")).should_not be_empty
|
46
46
|
}.should_not raise_error
|
47
47
|
end
|
48
48
|
|
49
49
|
it "works as both class and class instance" do
|
50
50
|
lambda {
|
51
51
|
Yuicssmin.compress(File.open(File.expand_path("../sample.css", __FILE__), "r:UTF-8").read).should_not be_empty
|
52
|
-
Yuicssmin.new.compress(File.open(File.expand_path("../sample.css", __FILE__), "r:UTF-8")).should_not be_empty
|
52
|
+
Yuicssmin.new.compress(File.open(File.expand_path("../sample.css", __FILE__), "r:UTF-8").read).should_not be_empty
|
53
53
|
}.should_not raise_error
|
54
54
|
end
|
55
55
|
|
@@ -145,7 +145,7 @@ describe "Yuicssmin" do
|
|
145
145
|
minified.should eq('.classname{margin:.6px .333pt 1.2em 8.8cm}')
|
146
146
|
end
|
147
147
|
|
148
|
-
it "simplifies
|
148
|
+
it "simplifies color values but preserves filter properties, RGBa values and ID strings" do
|
149
149
|
source = <<-EOS
|
150
150
|
.color-me {
|
151
151
|
color: rgb(123, 123, 123);
|
@@ -157,13 +157,13 @@ describe "Yuicssmin" do
|
|
157
157
|
minified.should eq('.color-me{color:#7b7b7b;border-color:#fed;background:none repeat scroll 0 0 #f00}')
|
158
158
|
|
159
159
|
source = <<-EOS
|
160
|
-
|
160
|
+
#AABBCC {
|
161
161
|
color: rgba(1, 2, 3, 4);
|
162
162
|
filter: chroma(color="#FFFFFF");
|
163
163
|
}
|
164
164
|
EOS
|
165
165
|
minified = Yuicssmin.compress(source)
|
166
|
-
minified.should eq('
|
166
|
+
minified.should eq('#AABBCC{color:rgba(1,2,3,4);filter:chroma(color="#FFFFFF")}')
|
167
167
|
end
|
168
168
|
|
169
169
|
it "only keeps the first charset declaration" do
|
data/yuicssmin.gemspec
CHANGED
@@ -22,8 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.rubyforge_project = "yuicssmin"
|
23
23
|
|
24
24
|
s.files = `git ls-files`.split("\n")
|
25
|
-
s.test_files = `git ls-files --
|
26
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
27
26
|
s.require_paths = ["lib"]
|
28
27
|
|
29
28
|
s.add_development_dependency "rspec"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yuicssmin
|
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-
|
12
|
+
date: 2012-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156006560 !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: *2156006560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: execjs
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156005760 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.3.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156005760
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: multi_json
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156034120 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.2
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156034120
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156033200 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '1.0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156033200
|
58
58
|
description: ! ' The YUICSSMIN gem provides CSS compression using YUI compressor
|
59
59
|
from Yahoo. Unlike other gems it doesn''t use the Java applet YUI compressor but
|
60
60
|
instead uses the Javascript port via ExecJS.
|
@@ -68,6 +68,7 @@ extra_rdoc_files:
|
|
68
68
|
- README.md
|
69
69
|
files:
|
70
70
|
- .gitignore
|
71
|
+
- CHANGES.md
|
71
72
|
- Gemfile
|
72
73
|
- LICENSE.md
|
73
74
|
- README.md
|