Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function print_atrule(node, indent_level, css) {
function print_prelude(node, indent_level, css) {
let buffer = substr(node, css)
return buffer
.replace(/([:,])/g, '$1 ') // force whitespace after colon or comma
.replace(/\s*([:,])/g, '$1 ') // force whitespace after colon or comma
.replace(/\(\s+/g, '(') // remove whitespace after (
.replace(/\s+\)/g, ')') // remove whitespace before )
.replace(/\s+/g, ' ') // collapse multiple whitespaces into one
Expand Down
1 change: 1 addition & 0 deletions test/atrules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Atrules('AtRule prelude formatting', () => {
[`@media all{}`, `@media all {}`],
[`@media all and print{}`, `@media all and print {}`],
[`@media (min-width:1000px){}`, `@media (min-width: 1000px) {}`],
[`@media (min-width : 1000px) {}`, `@media (min-width: 1000px) {}`],
[`@media all and (transform-3d) {}`, `@media all and (transform-3d) {}`],
[`@media all and (transform-3d), (-webkit-transform-3d) {}`, `@media all and (transform-3d), (-webkit-transform-3d) {}`],
[`@media screen or print {}`, `@media screen or print {}`],
Expand Down