-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support CSS nesting in CSS mixin (#2855)
* refactor: mark mixin anchor with unique selector * refactor: transform new mixin anchor * refactor: infer mixin marker in transformation * test: add skipped test to check mixin of CSS nesting * refactor: move asserters to core-test-kit * fix: handle nested when merging CSS fragment * feat: support nesting in CSS mixin * refactor: change marker to attribute * refactor: moved default arg to function signature * refactor: removed unnecessary spread
- Loading branch information
Showing
12 changed files
with
322 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type * as postcss from 'postcss'; | ||
|
||
export function assertRule(node: any, msg?: string): postcss.Rule { | ||
if (node?.type !== 'rule') { | ||
throw new Error('expected postcss rule' + (msg ? ` (${msg})` : '')); | ||
} | ||
return node; | ||
} | ||
export function assertAtRule(node: any, msg?: string): postcss.Rule { | ||
if (node?.type !== 'atrule') { | ||
throw new Error('expected postcss at-rule' + (msg ? ` (${msg})` : '')); | ||
} | ||
return node; | ||
} | ||
export function assertDecl(node: any, msg?: string): postcss.Declaration { | ||
if (node?.type !== 'decl') { | ||
throw new Error('expected postcss declaration' + (msg ? ` (${msg})` : '')); | ||
} | ||
return node; | ||
} | ||
export function assertComment(node: any, msg?: string): postcss.Comment { | ||
if (node?.type !== 'comment') { | ||
throw new Error('expected comment node' + (msg ? ` (${msg})` : '')); | ||
} | ||
return node; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.