Skip to content

Commit 2a3bad5

Browse files
committed
fix indentation of multiple selectors in @media. Closes #11
1 parent 1971959 commit 2a3bad5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/media.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
color: #000;
1717
}
1818

19-
body {
19+
body,
20+
#content {
2021
padding: 1in;
2122
border: 0.5pt solid #666;
2223
}
23-
}
24+
}

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,16 @@ Compiler.prototype.keyframe = function(node){
137137
*/
138138

139139
Compiler.prototype.rule = function(node){
140+
var indent = this.indent();
141+
140142
if (this.compress) {
141143
return node.selectors.join(',')
142144
+ '{'
143145
+ node.declarations.map(this.declaration, this).join(';')
144146
+ '}';
145147
}
146148

147-
return this.indent() + node.selectors.join(',\n')
149+
return node.selectors.map(function(s){ return indent + s }).join(',\n')
148150
+ ' {\n'
149151
+ this.indent(1)
150152
+ node.declarations.map(this.declaration, this).join(';\n')

0 commit comments

Comments
 (0)