Skip to content

Commit 28ab415

Browse files
committed
delay making @tailwind utilities a context node
If we do this _before_ handling `@apply`, then we won't be able to find a `@tailwind utilities` at-rule.
1 parent 91bd80a commit 28ab415

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/tailwindcss/src/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -624,14 +624,6 @@ async function parseCss(
624624
firstThemeRule.nodes = [context({ theme: true }, nodes)]
625625
}
626626

627-
// Replace the `@tailwind utilities` node with a context since it prints
628-
// children directly.
629-
if (utilitiesNode) {
630-
let node = utilitiesNode as AstNode as Context
631-
node.kind = 'context'
632-
node.context = {}
633-
}
634-
635627
// Replace the `@variant` at-rules with the actual variant rules.
636628
if (variantNodes.length > 0) {
637629
for (let variantNode of variantNodes) {
@@ -659,6 +651,14 @@ async function parseCss(
659651
features |= substituteFunctions(ast, designSystem)
660652
features |= substituteAtApply(ast, designSystem)
661653

654+
// Replace the `@tailwind utilities` node with a context since it prints
655+
// children directly.
656+
if (utilitiesNode) {
657+
let node = utilitiesNode as AstNode as Context
658+
node.kind = 'context'
659+
node.context = {}
660+
}
661+
662662
// Remove `@utility`, we couldn't replace it before yet because we had to
663663
// handle the nested `@apply` at-rules first.
664664
walk(ast, (node, { replaceWith }) => {

0 commit comments

Comments
 (0)