From 3bc80cda67a4f3eb2eefff4e5ae38fa36ad9a166 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 18 Apr 2025 13:12:09 -0400 Subject: [PATCH] Track wrapping at-rules created by imports --- packages/tailwindcss/src/at-import.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/tailwindcss/src/at-import.ts b/packages/tailwindcss/src/at-import.ts index 8853a9e5f..5f13cce99 100644 --- a/packages/tailwindcss/src/at-import.ts +++ b/packages/tailwindcss/src/at-import.ts @@ -57,6 +57,7 @@ export async function substituteAtImports( await substituteAtImports(ast, loaded.base, loadStylesheet, recurseCount + 1, track) contextNode.nodes = buildImportNodes( + node, [context({ base: loaded.base }, ast)], layer, media, @@ -148,6 +149,7 @@ export function parseImportParams(params: ValueParser.ValueAstNode[]) { } function buildImportNodes( + importNode: AstNode, importedAst: AstNode[], layer: string | null, media: string | null, @@ -157,16 +159,19 @@ function buildImportNodes( if (layer !== null) { let node = atRule('@layer', layer, root) + node.src = importNode.src root = [node] } if (media !== null) { let node = atRule('@media', media, root) + node.src = importNode.src root = [node] } if (supports !== null) { let node = atRule('@supports', supports[0] === '(' ? supports : `(${supports})`, root) + node.src = importNode.src root = [node] }