sqwish 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +10 -0
- data/README.md +2 -2
- data/lib/sqwish.rb +1 -1
- data/sqwish/src/index.js +2 -2
- metadata +3 -3
- data/sqwish/README.md +0 -53
data/HISTORY.md
ADDED
data/README.md
CHANGED
@@ -20,6 +20,6 @@ You can also use the `strict: false` flag (it defaults to true):
|
|
20
20
|
## Authors
|
21
21
|
|
22
22
|
* **Sqwish** is by Dustin Diaz @ [github.com/ded/sqwish](https://github.com/ded/sqwish).
|
23
|
-
* This Ruby gem is by Rico Sta. Cruz @ [github.com/rstacruz/sqwish.rb](http://github.com/rstacruz/sqwish.rb).
|
23
|
+
* This Ruby gem is by Rico Sta. Cruz @ [github.com/rstacruz/sqwish.rb](http://github.com/rstacruz/sqwish.rb).
|
24
24
|
|
25
|
-
MIT.
|
25
|
+
Released under the MIT license.
|
data/lib/sqwish.rb
CHANGED
data/sqwish/src/index.js
CHANGED
@@ -48,7 +48,7 @@ function sqwish(css, strict) {
|
|
48
48
|
|
49
49
|
// convert longhand hex to shorthand hex
|
50
50
|
.replace(/#([a-fA-F0-9])\1([a-fA-F0-9])\2([a-fA-F0-9])\3/g, '#$1$2$3')
|
51
|
-
|
51
|
+
|
52
52
|
// replace 0px with 0
|
53
53
|
.replace(/([\s|:])[0]+px/g, '$10');
|
54
54
|
|
@@ -124,4 +124,4 @@ module.exports.exec = function (args) {
|
|
124
124
|
};
|
125
125
|
module.exports.minify = function (css, strict) {
|
126
126
|
return sqwish(css, strict);
|
127
|
-
};
|
127
|
+
};
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Rico Sta. Cruz
|
@@ -42,8 +42,8 @@ extra_rdoc_files: []
|
|
42
42
|
|
43
43
|
files:
|
44
44
|
- lib/sqwish.rb
|
45
|
-
- sqwish/README.md
|
46
45
|
- sqwish/src/index.js
|
46
|
+
- HISTORY.md
|
47
47
|
- README.md
|
48
48
|
has_rdoc: true
|
49
49
|
homepage: http://github.com/rstacruz/sqwish
|
data/sqwish/README.md
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
Welcome to Sqwish
|
2
|
-
----------
|
3
|
-
A [Node](http://nodejs.org) based CSS Compressor. It works like this.
|
4
|
-
|
5
|
-
require('sqwish').minify('body { color: #ff33cc; }');
|
6
|
-
// =>
|
7
|
-
body{color:#f3c}
|
8
|
-
|
9
|
-
CLI
|
10
|
-
---
|
11
|
-
Install it.
|
12
|
-
|
13
|
-
$ npm install sqwish
|
14
|
-
|
15
|
-
Use it like this:
|
16
|
-
|
17
|
-
sqwish css/styles.css -o css/prod-styles.min.css
|
18
|
-
|
19
|
-
Notes
|
20
|
-
-------
|
21
|
-
Sqwish does not attempt to fix invalid CSS, therefore, at minimum, your CSS should at least follow the basic rules:
|
22
|
-
|
23
|
-
selectors[,more selectors] {
|
24
|
-
property: value;
|
25
|
-
another-property: another value;
|
26
|
-
}
|
27
|
-
|
28
|
-
Strict Optimizations
|
29
|
-
----------
|
30
|
-
Aside from regular minification, in <code>--strict</code> mode Sqwish will combines duplicate selectors and merge duplicate properties.
|
31
|
-
|
32
|
-
// before
|
33
|
-
div {
|
34
|
-
color: orange;
|
35
|
-
background: red;
|
36
|
-
}
|
37
|
-
div {
|
38
|
-
color: #ff33cc;
|
39
|
-
margin: 0px;
|
40
|
-
}
|
41
|
-
|
42
|
-
// after
|
43
|
-
div{color:#f3c;background:red;margin:0}
|
44
|
-
|
45
|
-
This mode can be enabled as so:
|
46
|
-
|
47
|
-
sqwish.minify(css, true);
|
48
|
-
|
49
|
-
on the command line
|
50
|
-
|
51
|
-
sqwish styles.css --strict
|
52
|
-
|
53
|
-
Happy Sqwishing!
|