File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change
1
+
2
+ body {
3
+
4
+ }
Original file line number Diff line number Diff line change
1
+
2
+ /**
3
+ * Module dependencies.
4
+ */
5
+
6
+ var parse = require ( 'css-parse' )
7
+ , stringify = require ( '..' )
8
+ , fs = require ( 'fs' )
9
+ , read = fs . readFileSync
10
+ , css = read ( 'examples/empty.css' , 'utf8' ) ;
11
+
12
+ console . log ( stringify ( parse ( css ) , { compress : true } ) ) ;
Original file line number Diff line number Diff line change @@ -178,18 +178,21 @@ Compiler.prototype.page = function(node){
178
178
179
179
Compiler . prototype . rule = function ( node ) {
180
180
var indent = this . indent ( ) ;
181
+ var decls = node . declarations ;
181
182
182
183
if ( this . compress ) {
184
+ if ( ! decls . length ) return '' ;
185
+
183
186
return node . selectors . join ( ',' )
184
187
+ '{'
185
- + node . declarations . map ( this . declaration , this ) . join ( ';' )
188
+ + decls . map ( this . declaration , this ) . join ( ';' )
186
189
+ '}' ;
187
190
}
188
191
189
192
return node . selectors . map ( function ( s ) { return indent + s } ) . join ( ',\n' )
190
193
+ ' {\n'
191
194
+ this . indent ( 1 )
192
- + node . declarations . map ( this . declaration , this ) . join ( ';\n' )
195
+ + decls . map ( this . declaration , this ) . join ( ';\n' )
193
196
+ this . indent ( - 1 )
194
197
+ '\n' + this . indent ( ) + '}' ;
195
198
} ;
You can’t perform that action at this time.
0 commit comments