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 src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ export function format(
return prelude
.replace(/\s*([:,])/g, prelude.toLowerCase().includes('selector(') ? '$1' : '$1 ') // force whitespace after colon or comma, except inside `selector()`
.replace(/\)([a-zA-Z])/g, ') $1') // force whitespace between closing parenthesis and following text (usually and|or)
.replace(/\s*(=>|<=)\s*/g, ' $1 ') // force whitespace around => and <=
.replace(/\s*(=>|>=|<=)\s*/g, `${OPTIONAL_SPACE}$1${OPTIONAL_SPACE}`) // add optional spacing around =>, >= and <=
.replace(/([^<>=\s])([<>])([^<>=\s])/g, `$1${OPTIONAL_SPACE}$2${OPTIONAL_SPACE}$3`) // add spacing around < or > except when it's part of <=, >=, =>
.replace(/\s+/g, OPTIONAL_SPACE) // collapse multiple whitespaces into one
.replace(
Expand Down
1 change: 1 addition & 0 deletions test/atrules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ test('@media prelude formatting', () => {
`@media (min-width: 1024px)or (max-width: 1439px) {}`,
`@media (min-width: 1024px) or (max-width: 1439px) {}`,
],
[`@media (width>=44rem)or (width<=33rem) {}`, `@media (width >= 44rem) or (width <= 33rem) {}`],
[
`@media all and (transform-3d), (-webkit-transform-3d) {}`,
`@media all and (transform-3d), (-webkit-transform-3d) {}`,
Expand Down
Loading