@@ -149,9 +149,15 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
149149 'project-a/src/index.css' : css `
150150 @reference 'tailwindcss/theme';
151151 @import 'tailwindcss/utilities';
152+ @import './imported.css';
152153 @config '../tailwind.config.js';
153154 @source '../../project-b/src/**/*.html';
154155 ` ,
156+ 'project-a/src/imported.css' : css `
157+ .imported {
158+ color: red;
159+ }
160+ ` ,
155161 'project-b/src/index.html' : html `
156162 <div class="flex" />
157163 ` ,
@@ -179,6 +185,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
179185 expect ( styles ) . toContain ( candidate `underline` )
180186 expect ( styles ) . toContain ( candidate `flex` )
181187 expect ( styles ) . toContain ( candidate `font-bold` )
188+ expect ( styles ) . toContain ( candidate `imported` )
182189 } )
183190
184191 await retryAssertion ( async ( ) => {
@@ -199,6 +206,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
199206 expect ( styles ) . toContain ( candidate `underline` )
200207 expect ( styles ) . toContain ( candidate `flex` )
201208 expect ( styles ) . toContain ( candidate `font-bold` )
209+ expect ( styles ) . toContain ( candidate `imported` )
202210 expect ( styles ) . toContain ( candidate `m-2` )
203211 } )
204212
@@ -216,6 +224,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
216224 expect ( styles ) . toContain ( candidate `underline` )
217225 expect ( styles ) . toContain ( candidate `flex` )
218226 expect ( styles ) . toContain ( candidate `font-bold` )
227+ expect ( styles ) . toContain ( candidate `imported` )
219228 expect ( styles ) . toContain ( candidate `m-2` )
220229 expect ( styles ) . toContain ( candidate `[.changed_&]:content-['project-b/src/index.js']` )
221230 } )
@@ -234,13 +243,52 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
234243 ` ,
235244 )
236245
246+ let styles = await fetchStyles ( url )
247+ expect ( styles ) . toContain ( candidate `red` )
248+ expect ( styles ) . toContain ( candidate `flex` )
249+ expect ( styles ) . toContain ( candidate `imported` )
250+ expect ( styles ) . toContain ( candidate `m-2` )
251+ expect ( styles ) . toContain ( candidate `underline` )
252+ expect ( styles ) . toContain ( candidate `[.changed_&]:content-['project-b/src/index.js']` )
253+ expect ( styles ) . toContain ( candidate `font-bold` )
254+ } )
255+
256+ await retryAssertion ( async ( ) => {
257+ // Trigger a partial rebuild for the next test
258+ await fs . write (
259+ 'project-a/index.html' ,
260+ html `
261+ <head>
262+ <link rel="stylesheet" href="./src/index.css" />
263+ </head>
264+ <body>
265+ <div class="m-4">Hello, world!</div>
266+ </body>
267+ ` ,
268+ )
269+ let styles = await fetchStyles ( url )
270+ expect ( styles ) . toContain ( candidate `m-4` )
271+ } )
272+
273+ await retryAssertion ( async ( ) => {
274+ // Changing an `@imported` CSS file after a partial rebuild also triggers the correct update
275+ await fs . write (
276+ 'project-a/src/imported.css' ,
277+ css `
278+ .imported-updated {
279+ color: red;
280+ }
281+ ` ,
282+ )
283+
237284 let styles = await fetchStyles ( url )
238285 expect ( styles ) . toContain ( candidate `red` )
239286 expect ( styles ) . toContain ( candidate `flex` )
240287 expect ( styles ) . toContain ( candidate `m-2` )
241288 expect ( styles ) . toContain ( candidate `underline` )
242289 expect ( styles ) . toContain ( candidate `[.changed_&]:content-['project-b/src/index.js']` )
243290 expect ( styles ) . toContain ( candidate `font-bold` )
291+ expect ( styles ) . toContain ( candidate `imported-updated` )
244292 } )
245293 } ,
246294 )
0 commit comments