Skip to content

Commit d6d69a9

Browse files
committed
#387: Fix space-after-opening-brace for empty media queries
1 parent 7940b30 commit d6d69a9

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

lib/options/space-after-opening-brace.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ module.exports = {
2323

2424
var value = this.getValue('space-after-opening-brace');
2525

26-
if (node.first().is('space')) {
26+
if (node.first() &&
27+
node.first().is('space')) {
2728
node.first().content = value;
2829
} else if (value !== '') {
2930
var space = gonzales.createNode({ type: 'space', content: value });
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@media only screen (max-width:479px) {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@media only screen (max-width:479px) {
2+
}

test/options/space-after-opening-brace/test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ describe('options/space-after-opening-brace:', function() {
2929
this.shouldBeEqual('test.css', 'test-3.expected.css');
3030
});
3131

32+
it('Issue 387', function() {
33+
this.comb.configure({ 'space-after-opening-brace': '\n' });
34+
this.shouldBeEqual('issue-387.css', 'issue-387.expected.css');
35+
});
36+
3237
it('Should detect no whitespace', function() {
3338
this.shouldDetect(
3439
['space-after-opening-brace'],

0 commit comments

Comments
 (0)