Skip to content

Commit e5a9c89

Browse files
author
Patrick Heller 💩
committed
remove empty media queries
1 parent 9f16bf5 commit e5a9c89

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

__tests__/sanity.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ it('generates the right CSS', () => {
1717
expect(result.css).toBe(expected)
1818
})
1919
})
20+
21+
it('Does not add something if not used at all', () => {
22+
return postcss([tailwind()])
23+
.process('')
24+
.then(result => {
25+
expect(result.css).toBe('')
26+
})
27+
})

src/lib/substituteResponsiveAtRules.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ export default function(config) {
2929
return cloned
3030
})
3131
)
32-
css.append(mediaQuery)
32+
33+
if(mediaQuery.nodes.length) {
34+
// do not add media query without any rules or comments
35+
css.append(mediaQuery)
36+
}
3337
})
3438
}
3539
}

0 commit comments

Comments
 (0)