ruby-clean-css 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +32 -5
- data/lib/ruby-clean-css/version.rb +1 -1
- metadata +10 -10
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,16 +4,16 @@ This gem provides a Ruby interface to the
|
|
4
4
|
[Clean-CSS](https://github.com/GoalSmashers/clean-css) Node library for
|
5
5
|
minifying CSS files.
|
6
6
|
|
7
|
-
Ruby-Clean-CSS provides
|
8
|
-
stylesheets than the
|
7
|
+
Ruby-Clean-CSS provides more up-to-date and compatible minification of
|
8
|
+
stylesheets than the [YUI
|
9
9
|
compressor](https://github.com/sstephenson/ruby-yui-compressor) (which was
|
10
10
|
[discontinued](http://www.yuiblog.com/blog/2012/10/16/state-of-yui-compressor)
|
11
|
-
by Yahoo in 2012)
|
11
|
+
by Yahoo in 2012)\*.
|
12
12
|
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
|
16
|
-
It's a gem
|
16
|
+
It's a gem, so:
|
17
17
|
|
18
18
|
$ gem install ruby-clean-css
|
19
19
|
|
@@ -109,7 +109,7 @@ minimise some code. That doesn't seem to bother most people, but if (like me)
|
|
109
109
|
you zealously weed out unnecessary dependencies, you may prefer to do
|
110
110
|
your asset precompilation on your dev machine (or a build server or similar).
|
111
111
|
In this case, you don't want to add the gem to the `:assets` group in your
|
112
|
-
Gemfile. You want it in the `:development` group
|
112
|
+
Gemfile. You want it in the `:development` group — gems in this group are
|
113
113
|
not typically bundled onto production servers.
|
114
114
|
|
115
115
|
Having done that, there may be another step before Rails will use
|
@@ -129,6 +129,33 @@ That's it. You don't need to change any practices. `rake assets:precompile`
|
|
129
129
|
will now work like you expect.
|
130
130
|
|
131
131
|
|
132
|
+
## \* Why this alternative?
|
133
|
+
|
134
|
+
The YUI CSS compressor has been a faithful servant for years. But there are
|
135
|
+
a few things it muddles up. The one that got me started was this:
|
136
|
+
|
137
|
+
-moz-transition: all 0s linear 200ms;
|
138
|
+
|
139
|
+
Which the YUI compressor rewrites to:
|
140
|
+
|
141
|
+
-moz-transition:all 0 linear 200ms;
|
142
|
+
|
143
|
+
Mozilla won't parse that, because `0` is not a valid time value. You may have
|
144
|
+
encountered other little gotchas, like `background:none` being erroneously
|
145
|
+
shortened to `background:0` and so on. In my testing, Clean-CSS produces a
|
146
|
+
higher fidelity compression in these areas. (Here's a handy online tool for
|
147
|
+
comparative testing: http://gpbmike.github.io/refresh-sf/)
|
148
|
+
|
149
|
+
Beyond that, Clean-CSS has some useful features around automatic inlining of
|
150
|
+
`@import` statements, and rebasing of URLs to a common root.
|
151
|
+
|
152
|
+
One final rationale is dependencies. Presumably you're also doing JS
|
153
|
+
minification, and these days you're probably using a JavaScript library
|
154
|
+
running on a JS VM to do it (Uglify, CoffeeScript, etc). Needing to install
|
155
|
+
and run a full Java VM purely for CSS minification is arguably wasteful —
|
156
|
+
it seems better to crush your styles the same way you crush the behavior.
|
157
|
+
|
158
|
+
|
132
159
|
## Contributing
|
133
160
|
|
134
161
|
Pull requests are welcome. Please supply a test case with your PR.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-clean-css
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
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: 2014-08-
|
12
|
+
date: 2014-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: therubyracer
|
16
|
-
requirement: &
|
16
|
+
requirement: &8039000 !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: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *8039000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: commonjs
|
27
|
-
requirement: &
|
27
|
+
requirement: &8037960 !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: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *8037960
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &8037300 !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: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *8037300
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: webmock
|
49
|
-
requirement: &
|
49
|
+
requirement: &8036660 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *8036660
|
58
58
|
description: A Ruby interface to the Clean-CSS minifier for Node.
|
59
59
|
email:
|
60
60
|
- jpearson@overdrive.com
|