ruby-clean-css 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -0
- data/EXAMPLE.md +25 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +30 -0
- data/LICENSE +19 -0
- data/README.md +106 -0
- data/lib/javascript/clean-css/.gitignore +4 -0
- data/lib/javascript/clean-css/.jshintignore +3 -0
- data/lib/javascript/clean-css/.jshintrc +14 -0
- data/lib/javascript/clean-css/.travis.yml +11 -0
- data/lib/javascript/clean-css/History.md +556 -0
- data/lib/javascript/clean-css/LICENSE +19 -0
- data/lib/javascript/clean-css/README.md +218 -0
- data/lib/javascript/clean-css/bin/cleancss +157 -0
- data/lib/javascript/clean-css/index.js +1 -0
- data/lib/javascript/clean-css/lib/clean.js +426 -0
- data/lib/javascript/clean-css/lib/colors/hsl-to-hex.js +64 -0
- data/lib/javascript/clean-css/lib/colors/long-to-short-hex.js +12 -0
- data/lib/javascript/clean-css/lib/colors/rgb-to-hex.js +14 -0
- data/lib/javascript/clean-css/lib/colors/shortener.js +174 -0
- data/lib/javascript/clean-css/lib/images/url-rebase.js +32 -0
- data/lib/javascript/clean-css/lib/images/url-rewriter.js +60 -0
- data/lib/javascript/clean-css/lib/imports/inliner.js +319 -0
- data/lib/javascript/clean-css/lib/properties/optimizer.js +276 -0
- data/lib/javascript/clean-css/lib/properties/override-compactor.js +116 -0
- data/lib/javascript/clean-css/lib/properties/processable.js +859 -0
- data/lib/javascript/clean-css/lib/properties/scanner.js +20 -0
- data/lib/javascript/clean-css/lib/properties/shorthand-compactor.js +244 -0
- data/lib/javascript/clean-css/lib/properties/token.js +184 -0
- data/lib/javascript/clean-css/lib/properties/validator.js +140 -0
- data/lib/javascript/clean-css/lib/selectors/empty-removal.js +30 -0
- data/lib/javascript/clean-css/lib/selectors/optimizer.js +341 -0
- data/lib/javascript/clean-css/lib/selectors/tokenizer.js +168 -0
- data/lib/javascript/clean-css/lib/text/comments.js +83 -0
- data/lib/javascript/clean-css/lib/text/escape-store.js +32 -0
- data/lib/javascript/clean-css/lib/text/expressions.js +73 -0
- data/lib/javascript/clean-css/lib/text/free.js +26 -0
- data/lib/javascript/clean-css/lib/text/name-quotes.js +37 -0
- data/lib/javascript/clean-css/lib/text/quote-scanner.js +91 -0
- data/lib/javascript/clean-css/lib/text/splitter.js +35 -0
- data/lib/javascript/clean-css/lib/text/urls.js +41 -0
- data/lib/javascript/clean-css/package.json +50 -0
- data/lib/javascript/clean-css/test/batch-test.js +56 -0
- data/lib/javascript/clean-css/test/bench.js +11 -0
- data/lib/javascript/clean-css/test/binary-test.js +323 -0
- data/lib/javascript/clean-css/test/data-bench/_partial.css +1 -0
- data/lib/javascript/clean-css/test/data-bench/complex.css +4 -0
- data/lib/javascript/clean-css/test/data/129-assets/assets/ui.css +2 -0
- data/lib/javascript/clean-css/test/data/129-assets/components/bootstrap/css/bootstrap.css +3 -0
- data/lib/javascript/clean-css/test/data/129-assets/components/bootstrap/images/glyphs.gif +0 -0
- data/lib/javascript/clean-css/test/data/129-assets/components/jquery-ui/css/style.css +6 -0
- data/lib/javascript/clean-css/test/data/129-assets/components/jquery-ui/images/next.gif +0 -0
- data/lib/javascript/clean-css/test/data/129-assets/components/jquery-ui/images/prev.gif +0 -0
- data/lib/javascript/clean-css/test/data/960-min.css +125 -0
- data/lib/javascript/clean-css/test/data/960.css +602 -0
- data/lib/javascript/clean-css/test/data/big-min.css +2984 -0
- data/lib/javascript/clean-css/test/data/big.css +13794 -0
- data/lib/javascript/clean-css/test/data/blueprint-min.css +245 -0
- data/lib/javascript/clean-css/test/data/blueprint.css +556 -0
- data/lib/javascript/clean-css/test/data/charset-mixed-with-fonts-min.css +3 -0
- data/lib/javascript/clean-css/test/data/charset-mixed-with-fonts.css +14 -0
- data/lib/javascript/clean-css/test/data/font-awesome-ie7-min.css +392 -0
- data/lib/javascript/clean-css/test/data/font-awesome-ie7.css +1203 -0
- data/lib/javascript/clean-css/test/data/font-awesome-min.css +319 -0
- data/lib/javascript/clean-css/test/data/font-awesome.css +540 -0
- data/lib/javascript/clean-css/test/data/imports-min.css +5 -0
- data/lib/javascript/clean-css/test/data/imports.css +4 -0
- data/lib/javascript/clean-css/test/data/issue-117-snippet-min.css +3 -0
- data/lib/javascript/clean-css/test/data/issue-117-snippet.css +19 -0
- data/lib/javascript/clean-css/test/data/issue-159-snippet-min.css +7 -0
- data/lib/javascript/clean-css/test/data/issue-159-snippet.css +7 -0
- data/lib/javascript/clean-css/test/data/issue-192-min.css +1 -0
- data/lib/javascript/clean-css/test/data/issue-192.css +8 -0
- data/lib/javascript/clean-css/test/data/issue-198-min.css +3 -0
- data/lib/javascript/clean-css/test/data/issue-198.css +4 -0
- data/lib/javascript/clean-css/test/data/issue-232-min.css +2 -0
- data/lib/javascript/clean-css/test/data/issue-232.css +17 -0
- data/lib/javascript/clean-css/test/data/issue-241-min.css +2 -0
- data/lib/javascript/clean-css/test/data/issue-241.css +2 -0
- data/lib/javascript/clean-css/test/data/issue-304-min.css +1 -0
- data/lib/javascript/clean-css/test/data/issue-304.css +4 -0
- data/lib/javascript/clean-css/test/data/issue-305-min.css +1 -0
- data/lib/javascript/clean-css/test/data/issue-305.css +3 -0
- data/lib/javascript/clean-css/test/data/issue-308-min.css +1 -0
- data/lib/javascript/clean-css/test/data/issue-308.css +5 -0
- data/lib/javascript/clean-css/test/data/issue-312-min.css +1 -0
- data/lib/javascript/clean-css/test/data/issue-312.css +7 -0
- data/lib/javascript/clean-css/test/data/issue-337-min.css +1 -0
- data/lib/javascript/clean-css/test/data/issue-337.css +4 -0
- data/lib/javascript/clean-css/test/data/line-breaks-in-attributes-min.css +2 -0
- data/lib/javascript/clean-css/test/data/line-breaks-in-attributes.css +8 -0
- data/lib/javascript/clean-css/test/data/partials-absolute/base.css +3 -0
- data/lib/javascript/clean-css/test/data/partials-absolute/base2.css +1 -0
- data/lib/javascript/clean-css/test/data/partials-absolute/extra/sub.css +3 -0
- data/lib/javascript/clean-css/test/data/partials-relative/base.css +3 -0
- data/lib/javascript/clean-css/test/data/partials-relative/extra/included.css +1 -0
- data/lib/javascript/clean-css/test/data/partials/comment.css +2 -0
- data/lib/javascript/clean-css/test/data/partials/extra/down.gif +0 -0
- data/lib/javascript/clean-css/test/data/partials/extra/four.css +3 -0
- data/lib/javascript/clean-css/test/data/partials/extra/three.css +1 -0
- data/lib/javascript/clean-css/test/data/partials/five.css +1 -0
- data/lib/javascript/clean-css/test/data/partials/four.css +1 -0
- data/lib/javascript/clean-css/test/data/partials/one.css +1 -0
- data/lib/javascript/clean-css/test/data/partials/three.css +1 -0
- data/lib/javascript/clean-css/test/data/partials/two.css +5 -0
- data/lib/javascript/clean-css/test/data/reset-min.css +12 -0
- data/lib/javascript/clean-css/test/data/reset.css +64 -0
- data/lib/javascript/clean-css/test/data/sample1-min.css +4 -0
- data/lib/javascript/clean-css/test/data/sample1.css +12 -0
- data/lib/javascript/clean-css/test/data/unsupported/selectors-ie7.css +20 -0
- data/lib/javascript/clean-css/test/data/unsupported/selectors-ie8.css +17 -0
- data/lib/javascript/clean-css/test/module-test.js +185 -0
- data/lib/javascript/clean-css/test/protocol-imports-test.js +409 -0
- data/lib/javascript/clean-css/test/text/splitter-test.js +20 -0
- data/lib/javascript/clean-css/test/unit-test.js +2071 -0
- data/lib/ruby-clean-css.rb +6 -0
- data/lib/ruby-clean-css/compressor.rb +142 -0
- data/lib/ruby-clean-css/exports.rb +258 -0
- data/lib/ruby-clean-css/railtie.rb +27 -0
- data/lib/ruby-clean-css/sprockets.rb +19 -0
- data/lib/ruby-clean-css/version.rb +5 -0
- data/ruby-clean-css.gemspec +30 -0
- data/test/test_compressor.rb +84 -0
- metadata +203 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
@media print, (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
|
2
|
+
/* Style adjustments for high resolution devices */
|
3
|
+
}
|
4
|
+
/**===================================================**\
|
5
|
+
/** PRINT STYLES
|
6
|
+
/**===================================================**/
|
7
|
+
@media only print {
|
8
|
+
a,
|
9
|
+
a:visited {
|
10
|
+
text-decoration: underline;
|
11
|
+
}
|
12
|
+
a[href]:after {
|
13
|
+
content: " (" attr(href) ")";
|
14
|
+
}
|
15
|
+
abbr[title]:after {
|
16
|
+
content: " (" attr(title) ")";
|
17
|
+
}
|
18
|
+
/** MANUALLY TRUNCATED FOR BREVITY **/
|
19
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
.zocial.acrobat:before{content:"\00E3";color:#FB0000}
|
2
|
+
.zocial.amazon:before{content:"a"}
|
3
|
+
.zocial.android:before{content:"&"}
|
4
|
+
.zocial.angellist:before{content:"\00D6"}
|
5
|
+
.zocial.aol:before{content:"\""}
|
6
|
+
.zocial.appnet:before{content:"\00E1"}
|
7
|
+
.zocial.appstore:before{content:"A"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
.zocial.acrobat:before {content: "\00E3"; color: #FB0000;}
|
2
|
+
.zocial.amazon:before {content: "a";}
|
3
|
+
.zocial.android:before {content: "&";}
|
4
|
+
.zocial.angellist:before {content: "\00D6";}
|
5
|
+
.zocial.aol:before {content: "\"";}
|
6
|
+
.zocial.appnet:before {content: "\00E1";}
|
7
|
+
.zocial.appstore:before {content: "A";}
|
@@ -0,0 +1 @@
|
|
1
|
+
.vrac{overflow:hidden;position:relative}
|
@@ -0,0 +1 @@
|
|
1
|
+
.test{background:url(top.png) left 0 top -12px no-repeat,url(bottom.png) left 0 bottom -12px no-repeat,url(middle.png) left 0 top 0 no-repeat}
|
@@ -0,0 +1 @@
|
|
1
|
+
div{border-width:thin}
|
@@ -0,0 +1 @@
|
|
1
|
+
p{background-image:url(/*)}
|
@@ -0,0 +1 @@
|
|
1
|
+
.envelope{background:url(one.png) top center/35px 4px repeat-x,url(one.png) bottom center/35px 4px repeat-x,url(two.png) 110% 10px/101px 61px no-repeat #eee}
|
@@ -0,0 +1 @@
|
|
1
|
+
div{background:#fff!important}
|
@@ -0,0 +1 @@
|
|
1
|
+
.base2 { border-width:0px }
|
@@ -0,0 +1 @@
|
|
1
|
+
@import '../base.css';
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
.three { color:#0f0; }
|
@@ -0,0 +1 @@
|
|
1
|
+
.five{background:url(data:image/jpeg;base64,/9j/)}
|
@@ -0,0 +1 @@
|
|
1
|
+
.four {background-image: url(/partials/extra/down.gif);}
|
@@ -0,0 +1 @@
|
|
1
|
+
.one { color:#f00; }
|
@@ -0,0 +1 @@
|
|
1
|
+
.three {background-image: url(extra/down.gif);}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
a,abbr,acronym,address,applet,big,blockquote,body,caption,cite,code,dd,del,dfn,div,dl,dt,em,fieldset,font,form,h1,h2,h3,h4,h5,h6,html,iframe,img,ins,kbd,label,legend,li,object,ol,p,pre,q,s,samp,small,span,strike,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,tt,ul,var{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline}
|
2
|
+
:focus{outline:0}
|
3
|
+
body{line-height:1;color:#000;background:#fff}
|
4
|
+
ol,ul{list-style:none}
|
5
|
+
table{border-collapse:separate;border-spacing:0}
|
6
|
+
caption,td,th{text-align:left;font-weight:400}
|
7
|
+
blockquote:after,blockquote:before,q:after,q:before{content:""}
|
8
|
+
blockquote,q{quotes:"" ""}
|
9
|
+
.clear{clear:both}
|
10
|
+
.clear:after,.container:after{content:".";display:block;height:0;clear:both;visibility:hidden}
|
11
|
+
* html .clear{height:1%}
|
12
|
+
.clear{display:block}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/*reset*/
|
2
|
+
html, body, div, span, applet, object, iframe,
|
3
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
4
|
+
a, abbr, acronym, address, big, cite, code,
|
5
|
+
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
6
|
+
small, strike, strong, sub, sup, tt, var,
|
7
|
+
dl, dt, dd, ol, ul, li,
|
8
|
+
fieldset, form, label, legend,
|
9
|
+
table, caption, tbody, tfoot, thead, tr, th, td {
|
10
|
+
margin: 0;
|
11
|
+
padding: 0;
|
12
|
+
border: 0;
|
13
|
+
outline: 0;
|
14
|
+
font-weight: inherit;
|
15
|
+
font-style: inherit;
|
16
|
+
font-size: 100%;
|
17
|
+
font-family: inherit;
|
18
|
+
vertical-align: baseline;
|
19
|
+
}
|
20
|
+
/* remember to define focus styles! */
|
21
|
+
:focus {
|
22
|
+
outline: 0;
|
23
|
+
}
|
24
|
+
body {
|
25
|
+
line-height: 1;
|
26
|
+
color: black;
|
27
|
+
background: white;
|
28
|
+
}
|
29
|
+
ol, ul {
|
30
|
+
list-style: none;
|
31
|
+
}
|
32
|
+
/* tables still need 'cellspacing="0"' in the markup */
|
33
|
+
table {
|
34
|
+
border-collapse: separate;
|
35
|
+
border-spacing: 0;
|
36
|
+
}
|
37
|
+
caption, th, td {
|
38
|
+
text-align: left;
|
39
|
+
font-weight: normal;
|
40
|
+
}
|
41
|
+
blockquote:before, blockquote:after,
|
42
|
+
q:before, q:after {
|
43
|
+
content: "";
|
44
|
+
}
|
45
|
+
blockquote, q {
|
46
|
+
quotes: "" "";
|
47
|
+
}
|
48
|
+
.clear {
|
49
|
+
clear:both;
|
50
|
+
display: inline-block;
|
51
|
+
}
|
52
|
+
.clear:after, .container:after {
|
53
|
+
content: ".";
|
54
|
+
display: block;
|
55
|
+
height: 0;
|
56
|
+
clear: both;
|
57
|
+
visibility: hidden;
|
58
|
+
}
|
59
|
+
* html .clear {
|
60
|
+
height: 1%;
|
61
|
+
}
|
62
|
+
.clear {
|
63
|
+
display: block;
|
64
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
p:focus{top:0}
|
2
|
+
p:before{top:0}
|
3
|
+
p:after{top:0}
|
4
|
+
p:root{top:0}
|
5
|
+
p:nth-of-type(1){top:0}
|
6
|
+
p:nth-last-of-type(1){top:0}
|
7
|
+
p:first-of-type{top:0}
|
8
|
+
p:last-of-type{top:0}
|
9
|
+
p:only-of-type{top:0}
|
10
|
+
p:only-child{top:0}
|
11
|
+
p:last-child{top:0}
|
12
|
+
p:nth-child(1){top:0}
|
13
|
+
p:nth-last-child(1){top:0}
|
14
|
+
p:empty{top:0}
|
15
|
+
p:target{top:0}
|
16
|
+
p:checked{top:0}
|
17
|
+
p::selection{top:0}
|
18
|
+
input:enabled{top:0}
|
19
|
+
input:disabled{top:0}
|
20
|
+
p:not(.x){top:0}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
p:root{top:0}
|
2
|
+
p:nth-of-type(1){top:0}
|
3
|
+
p:nth-last-of-type(1){top:0}
|
4
|
+
p:first-of-type{top:0}
|
5
|
+
p:last-of-type{top:0}
|
6
|
+
p:only-of-type{top:0}
|
7
|
+
p:only-child{top:0}
|
8
|
+
p:last-child{top:0}
|
9
|
+
p:nth-child(1){top:0}
|
10
|
+
p:nth-last-child(1){top:0}
|
11
|
+
p:empty{top:0}
|
12
|
+
p:target{top:0}
|
13
|
+
p:checked{top:0}
|
14
|
+
p::selection{top:0}
|
15
|
+
input:enabled{top:0}
|
16
|
+
input:disabled{top:0}
|
17
|
+
p:not(.x){top:0}
|
@@ -0,0 +1,185 @@
|
|
1
|
+
var vows = require('vows');
|
2
|
+
var assert = require('assert');
|
3
|
+
var CleanCSS = require('../index');
|
4
|
+
|
5
|
+
vows.describe('module tests').addBatch({
|
6
|
+
'imported as a function': {
|
7
|
+
topic: function() {
|
8
|
+
var css = new CleanCSS();
|
9
|
+
return css.minify.bind(css);
|
10
|
+
},
|
11
|
+
'should minify CSS correctly': function(minify) {
|
12
|
+
assert.equal(minify('a{ color: #f00; }'), 'a{color:red}');
|
13
|
+
}
|
14
|
+
},
|
15
|
+
'initialization without new (back-compat)': {
|
16
|
+
topic: function() {
|
17
|
+
return CleanCSS();
|
18
|
+
},
|
19
|
+
'should have stats, errors, etc.': function(css) {
|
20
|
+
assert.isObject(css.stats);
|
21
|
+
assert.isArray(css.errors);
|
22
|
+
assert.isArray(css.warnings);
|
23
|
+
assert.isString(css.lineBreak);
|
24
|
+
},
|
25
|
+
'should minify CSS correctly': function(css) {
|
26
|
+
assert.equal(css.minify('a{ color: #f00; }'), 'a{color:red}');
|
27
|
+
}
|
28
|
+
},
|
29
|
+
'extended via prototype': {
|
30
|
+
topic: function() {
|
31
|
+
CleanCSS.prototype.foo = function(data, callback) {
|
32
|
+
callback(null, this.minify(data));
|
33
|
+
};
|
34
|
+
new CleanCSS().foo('a{ color: #f00; }', this.callback);
|
35
|
+
},
|
36
|
+
'should minify CSS correctly': function(error, minified) {
|
37
|
+
assert.equal(minified, 'a{color:red}');
|
38
|
+
},
|
39
|
+
teardown: function() {
|
40
|
+
delete CleanCSS.prototype.foo;
|
41
|
+
}
|
42
|
+
},
|
43
|
+
'with callback passed and no errors': {
|
44
|
+
topic: function() {
|
45
|
+
new CleanCSS().minify('a{color:#f00}', this.callback);
|
46
|
+
},
|
47
|
+
'should correctly set context': function() {
|
48
|
+
assert.equal(true, this instanceof CleanCSS);
|
49
|
+
},
|
50
|
+
'should yield no error': function(errors, minified) {
|
51
|
+
/* jshint unused: false */
|
52
|
+
assert.equal(errors, null);
|
53
|
+
},
|
54
|
+
'should yield minified data': function(errors, minified) {
|
55
|
+
assert.equal(minified, 'a{color:red}');
|
56
|
+
}
|
57
|
+
},
|
58
|
+
'with callback passed and one error': {
|
59
|
+
topic: function() {
|
60
|
+
new CleanCSS().minify('@import "missing.css";', this.callback);
|
61
|
+
},
|
62
|
+
'should yield no error and minify': function(errors, minified) {
|
63
|
+
/* jshint unused: false */
|
64
|
+
assert.equal(errors.length, 1);
|
65
|
+
}
|
66
|
+
},
|
67
|
+
'no debug': {
|
68
|
+
topic: function() {
|
69
|
+
var minifier = new CleanCSS();
|
70
|
+
minifier.minify('a{ color: #f00 }');
|
71
|
+
return minifier;
|
72
|
+
},
|
73
|
+
'should not populate stats hash': function(minifier) {
|
74
|
+
assert.deepEqual({}, minifier.stats);
|
75
|
+
}
|
76
|
+
},
|
77
|
+
'debug': {
|
78
|
+
topic: function() {
|
79
|
+
var minifier = new CleanCSS({ debug: true });
|
80
|
+
minifier.minify('a{ color: #f00 }');
|
81
|
+
return minifier;
|
82
|
+
},
|
83
|
+
'should give time taken': function(minifier) {
|
84
|
+
assert.isNumber(minifier.stats.timeSpent);
|
85
|
+
},
|
86
|
+
'should give original size': function(minifier) {
|
87
|
+
assert.equal(minifier.stats.originalSize, 16);
|
88
|
+
},
|
89
|
+
'should give minified size': function(minifier) {
|
90
|
+
assert.equal(minifier.stats.minifiedSize, 12);
|
91
|
+
},
|
92
|
+
'should give efficiency': function(minifier) {
|
93
|
+
assert.equal(minifier.stats.efficiency, 0.25);
|
94
|
+
}
|
95
|
+
},
|
96
|
+
'no warnings': {
|
97
|
+
topic: function() {
|
98
|
+
var minifier = new CleanCSS();
|
99
|
+
minifier.minify('a{color:red}');
|
100
|
+
return minifier;
|
101
|
+
},
|
102
|
+
'if no reasons given': function(minifier) {
|
103
|
+
assert.deepEqual(minifier.warnings, []);
|
104
|
+
}
|
105
|
+
},
|
106
|
+
'warnings': {
|
107
|
+
topic: function() {
|
108
|
+
var minifier = new CleanCSS({
|
109
|
+
root: 'test/data',
|
110
|
+
target: 'custom-warnings.css'
|
111
|
+
});
|
112
|
+
minifier.minify('a{color:red}');
|
113
|
+
return minifier;
|
114
|
+
},
|
115
|
+
'if both root and output used reasons given': function(minifier) {
|
116
|
+
assert.equal(minifier.warnings.length, 1);
|
117
|
+
assert.match(minifier.warnings[0], /Both 'root' and output file given/);
|
118
|
+
}
|
119
|
+
},
|
120
|
+
'warnings on extra closing brace': {
|
121
|
+
topic: function() {
|
122
|
+
var minifier = new CleanCSS();
|
123
|
+
var minified = minifier.minify('a{display:block}}');
|
124
|
+
this.callback(null, minified, minifier);
|
125
|
+
},
|
126
|
+
'should minify correctly': function(error, minified) {
|
127
|
+
assert.equal(minified, 'a{display:block}');
|
128
|
+
},
|
129
|
+
'should raise no errors': function(error, minified, minifier) {
|
130
|
+
assert.equal(minifier.errors.length, 0);
|
131
|
+
},
|
132
|
+
'should raise one warning': function(error, minified, minifier) {
|
133
|
+
assert.equal(minifier.warnings.length, 1);
|
134
|
+
assert.equal(minifier.warnings[0], 'Unexpected \'}\' in \'a{display:block}}\'. Ignoring.');
|
135
|
+
}
|
136
|
+
},
|
137
|
+
'warnings on unexpected body': {
|
138
|
+
topic: function() {
|
139
|
+
var minifier = new CleanCSS();
|
140
|
+
var minified = minifier.minify('a{display:block}color:#535353}p{color:red}');
|
141
|
+
this.callback(null, minified, minifier);
|
142
|
+
},
|
143
|
+
'should minify correctly': function(error, minified) {
|
144
|
+
assert.equal(minified, 'a{display:block}p{color:red}');
|
145
|
+
},
|
146
|
+
'should raise no errors': function(error, minified, minifier) {
|
147
|
+
assert.equal(minifier.errors.length, 0);
|
148
|
+
},
|
149
|
+
'should raise one warning': function(error, minified, minifier) {
|
150
|
+
assert.equal(minifier.warnings.length, 1);
|
151
|
+
assert.equal(minifier.warnings[0], 'Unexpected content: \'color:#535353}\'. Ignoring.');
|
152
|
+
}
|
153
|
+
},
|
154
|
+
'no errors': {
|
155
|
+
topic: function() {
|
156
|
+
var minifier = new CleanCSS();
|
157
|
+
minifier.minify('a{color:red}');
|
158
|
+
return minifier;
|
159
|
+
},
|
160
|
+
'if no reasons given': function(minifier) {
|
161
|
+
assert.deepEqual(minifier.errors, []);
|
162
|
+
}
|
163
|
+
},
|
164
|
+
'errors': {
|
165
|
+
topic: function() {
|
166
|
+
return new CleanCSS();
|
167
|
+
},
|
168
|
+
'if both root and output used reasons given': function(minifier) {
|
169
|
+
assert.doesNotThrow(function() {
|
170
|
+
minifier.minify('@import url(/some/fake/file);', function(errors) {
|
171
|
+
assert.equal(errors.length, 1);
|
172
|
+
assert.equal(errors[0], 'Broken @import declaration of "/some/fake/file"');
|
173
|
+
});
|
174
|
+
});
|
175
|
+
}
|
176
|
+
},
|
177
|
+
'buffer passed in': {
|
178
|
+
'topic': function() {
|
179
|
+
return new CleanCSS().minify(new Buffer('@import url(test/data/partials/one.css);'));
|
180
|
+
},
|
181
|
+
'should be processed correctly': function(minified) {
|
182
|
+
assert.equal('.one{color:red}', minified);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}).export(module);
|