Skip to content

Commit 3a4ba87

Browse files
committed
small refactor: only check for -- once
1 parent 01b0a6b commit 3a4ba87

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

packages/tailwindcss/src/compat/plugin-api.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -499,17 +499,18 @@ export function objectToAst(rules: CssInJs | CssInJs[]): AstNode[] {
499499

500500
for (let [name, value] of entries) {
501501
if (typeof value !== 'object') {
502-
if (!name.startsWith('--') && value === '@slot') {
503-
ast.push(rule(name, [atRule('@slot')]))
504-
} else {
505-
if (!name.startsWith('--')) {
506-
// Convert camelCase to kebab-case:
507-
// https://github.com/postcss/postcss-js/blob/b3db658b932b42f6ac14ca0b1d50f50c4569805b/parser.js#L30-L35
508-
name = name.replace(/([A-Z])/g, '-$1').toLowerCase()
502+
if (!name.startsWith('--')) {
503+
if (value === '@slot') {
504+
ast.push(rule(name, [atRule('@slot')]))
505+
continue
509506
}
510507

511-
ast.push(decl(name, String(value)))
508+
// Convert camelCase to kebab-case:
509+
// https://github.com/postcss/postcss-js/blob/b3db658b932b42f6ac14ca0b1d50f50c4569805b/parser.js#L30-L35
510+
name = name.replace(/([A-Z])/g, '-$1').toLowerCase()
512511
}
512+
513+
ast.push(decl(name, String(value)))
513514
} else if (Array.isArray(value)) {
514515
for (let item of value) {
515516
if (typeof item === 'string') {

0 commit comments

Comments
 (0)