@@ -256,159 +256,157 @@ describe.each([
256
256
)
257
257
} )
258
258
259
- describe . only ( '@source' , ( ) => {
260
- test (
261
- 'it works' ,
262
- {
263
- fs : {
264
- 'package.json' : json `{}` ,
265
- 'pnpm-workspace.yaml' : yaml `
266
- #
267
- packages:
268
- - project-a
269
- ` ,
270
- 'project-a/package.json' : json `
271
- {
272
- "dependencies": {
273
- "tailwindcss": "workspace:^",
274
- "@tailwindcss/cli": "workspace:^"
275
- }
259
+ test (
260
+ 'source(…) and `@source` can be configured to use auto source detection' ,
261
+ {
262
+ fs : {
263
+ 'package.json' : json `{}` ,
264
+ 'pnpm-workspace.yaml' : yaml `
265
+ #
266
+ packages:
267
+ - project-a
268
+ ` ,
269
+ 'project-a/package.json' : json `
270
+ {
271
+ "dependencies": {
272
+ "tailwindcss": "workspace:^",
273
+ "@tailwindcss/cli": "workspace:^"
276
274
}
277
- ` ,
278
- 'project-a/src/index.css' : css `
279
- @import 'tailwindcss/theme' theme(reference);
275
+ }
276
+ ` ,
277
+ 'project-a/src/index.css' : css `
278
+ @import 'tailwindcss/theme' theme(reference);
280
279
281
- /* Run auto-content detection in ../../project-b */
282
- @import 'tailwindcss/utilities' source('../../project-b');
280
+ /* Run auto-content detection in ../../project-b */
281
+ @import 'tailwindcss/utilities' source('../../project-b');
283
282
284
- /* Additive: */
285
- /* {my-lib-1,my-lib-2}: expand */
286
- /* *.html: only look for .html */
287
- @source '../node_modules/{my-lib-1,my-lib-2}/src/**/*.html';
283
+ /* Additive: */
284
+ /* {my-lib-1,my-lib-2}: expand */
285
+ /* *.html: only look for .html */
286
+ @source '../node_modules/{my-lib-1,my-lib-2}/src/**/*.html';
288
287
289
- /* We typically ignore these extensions, but now include them explicitly */
290
- @source './logo.{jpg,png}';
288
+ /* We typically ignore these extensions, but now include them explicitly */
289
+ @source './logo.{jpg,png}';
291
290
292
- /* Project C should apply auto source detection */
293
- @source '../../project-c';
294
- ` ,
291
+ /* Project C should apply auto source detection */
292
+ @source '../../project-c';
293
+ ` ,
295
294
296
- // Project A is the current folder, but we explicitly configured
297
- // `source(project-b)`, therefore project-a should not be included in
298
- // the output.
299
- 'project-a/src/index.html' : html `
300
- < div
301
- class ="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-a/src/index.html'] "
302
- > </ div >
303
- ` ,
295
+ // Project A is the current folder, but we explicitly configured
296
+ // `source(project-b)`, therefore project-a should not be included in
297
+ // the output.
298
+ 'project-a/src/index.html' : html `
299
+ < div
300
+ class ="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-a/src/index.html'] "
301
+ > </ div >
302
+ ` ,
304
303
305
- // Project A explicitly includes an extension we usually ignore,
306
- // therefore it should be included in the output.
307
- 'project-a/src/logo.jpg' : html `
308
- < div
309
- class ="content-['project-a/src/logo.jpg'] "
310
- > </ div >
311
- ` ,
304
+ // Project A explicitly includes an extension we usually ignore,
305
+ // therefore it should be included in the output.
306
+ 'project-a/src/logo.jpg' : html `
307
+ < div
308
+ class ="content-['project-a/src/logo.jpg'] "
309
+ > </ div >
310
+ ` ,
312
311
313
- // Project A explicitly includes node_modules/{my-lib-1,my-lib-2},
314
- // therefore these files should be included in the output.
315
- 'project-a/node_modules/my-lib-1/src/index.html' : html `
316
- < div
317
- class ="content-['project-a/node_modules/my-lib-1/src/index.html'] "
318
- > </ div >
319
- ` ,
320
- 'project-a/node_modules/my-lib-2/src/index.html' : html `
321
- < div
322
- class ="content-['project-a/node_modules/my-lib-2/src/index.html'] "
323
- > </ div >
324
- ` ,
312
+ // Project A explicitly includes node_modules/{my-lib-1,my-lib-2},
313
+ // therefore these files should be included in the output.
314
+ 'project-a/node_modules/my-lib-1/src/index.html' : html `
315
+ < div
316
+ class ="content-['project-a/node_modules/my-lib-1/src/index.html'] "
317
+ > </ div >
318
+ ` ,
319
+ 'project-a/node_modules/my-lib-2/src/index.html' : html `
320
+ < div
321
+ class ="content-['project-a/node_modules/my-lib-2/src/index.html'] "
322
+ > </ div >
323
+ ` ,
325
324
326
- // Project B is the configured `source(…)`, therefore auto source
327
- // detection should include known extensions and folders in the output.
328
- 'project-b/src/index.html' : html `
329
- < div
330
- class ="content-['project-b/src/index.html'] "
331
- > </ div >
332
- ` ,
325
+ // Project B is the configured `source(…)`, therefore auto source
326
+ // detection should include known extensions and folders in the output.
327
+ 'project-b/src/index.html' : html `
328
+ < div
329
+ class ="content-['project-b/src/index.html'] "
330
+ > </ div >
331
+ ` ,
333
332
334
- // Project B is the configured `source(…)`, therefore auto source
335
- // detection should apply and node_modules should not be included in the
336
- // output.
337
- 'project-b/node_modules/my-lib-3/src/index.html' : html `
338
- < div
339
- class ="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-b/node_modules/my-lib-3/src/index.html'] "
340
- > </ div >
341
- ` ,
333
+ // Project B is the configured `source(…)`, therefore auto source
334
+ // detection should apply and node_modules should not be included in the
335
+ // output.
336
+ 'project-b/node_modules/my-lib-3/src/index.html' : html `
337
+ < div
338
+ class ="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-b/node_modules/my-lib-3/src/index.html'] "
339
+ > </ div >
340
+ ` ,
342
341
343
- // Project C should apply auto source detection, therefore known
344
- // extensions and folders should be included in the output.
345
- 'project-c/src/index.html' : html `
346
- < div
347
- class ="content-['project-c/src/index.html'] "
348
- > </ div >
349
- ` ,
342
+ // Project C should apply auto source detection, therefore known
343
+ // extensions and folders should be included in the output.
344
+ 'project-c/src/index.html' : html `
345
+ < div
346
+ class ="content-['project-c/src/index.html'] "
347
+ > </ div >
348
+ ` ,
350
349
351
- // Project C should apply auto source detection, therefore known ignored
352
- // extensions should not be included in the output.
353
- 'project-c/src/logo.jpg' : html `
354
- < div
355
- class ="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-c/src/logo.jpg'] "
356
- > </ div >
357
- ` ,
350
+ // Project C should apply auto source detection, therefore known ignored
351
+ // extensions should not be included in the output.
352
+ 'project-c/src/logo.jpg' : html `
353
+ < div
354
+ class ="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-c/src/logo.jpg'] "
355
+ > </ div >
356
+ ` ,
358
357
359
- // Project C should apply auto source detection, therefore node_modules
360
- // should not be included in the output.
361
- 'project-c/node_modules/my-lib-1/src/index.html' : html `
362
- < div
363
- class ="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-c/node_modules/my-lib-1/src/index.html'] "
364
- > </ div >
365
- ` ,
366
- } ,
358
+ // Project C should apply auto source detection, therefore node_modules
359
+ // should not be included in the output.
360
+ 'project-c/node_modules/my-lib-1/src/index.html' : html `
361
+ < div
362
+ class ="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-c/node_modules/my-lib-1/src/index.html'] "
363
+ > </ div >
364
+ ` ,
367
365
} ,
368
- async ( { fs, exec, root } ) => {
369
- console . log (
370
- await exec ( 'pnpm tailwindcss --input src/index.css --output dist/out.css' , {
371
- cwd : path . join ( root , 'project-a' ) ,
372
- } ) ,
373
- )
366
+ } ,
367
+ async ( { fs, exec, root } ) => {
368
+ console . log (
369
+ await exec ( 'pnpm tailwindcss --input src/index.css --output dist/out.css' , {
370
+ cwd : path . join ( root , 'project-a' ) ,
371
+ } ) ,
372
+ )
374
373
375
- expect ( await fs . dumpFiles ( './project-a/dist/*.css' ) ) . toMatchInlineSnapshot ( `
376
- "
377
- --- ./project-a/dist/out.css ---
378
- .content-\\[\\'project-a\\/node_modules\\/my-lib-1\\/src\\/index\\.html\\'\\] {
379
- --tw-content: 'project-a/node modules/my-lib-1/src/index.html';
380
- content: var(--tw-content);
381
- }
382
- .content-\\[\\'project-a\\/node_modules\\/my-lib-2\\/src\\/index\\.html\\'\\] {
383
- --tw-content: 'project-a/node modules/my-lib-2/src/index.html';
384
- content: var(--tw-content);
385
- }
386
- .content-\\[\\'project-a\\/src\\/logo\\.jpg\\'\\] {
387
- --tw-content: 'project-a/src/logo.jpg';
388
- content: var(--tw-content);
389
- }
390
- .content-\\[\\'project-b\\/src\\/index\\.html\\'\\] {
391
- --tw-content: 'project-b/src/index.html';
392
- content: var(--tw-content);
393
- }
394
- .content-\\[\\'project-c\\/src\\/index\\.html\\'\\] {
395
- --tw-content: 'project-c/src/index.html';
396
- content: var(--tw-content);
397
- }
398
- @supports (-moz-orient: inline) {
399
- @layer base {
400
- *, ::before, ::after, ::backdrop {
401
- --tw-content: "";
402
- }
374
+ expect ( await fs . dumpFiles ( './project-a/dist/*.css' ) ) . toMatchInlineSnapshot ( `
375
+ "
376
+ --- ./project-a/dist/out.css ---
377
+ .content-\\[\\'project-a\\/node_modules\\/my-lib-1\\/src\\/index\\.html\\'\\] {
378
+ --tw-content: 'project-a/node modules/my-lib-1/src/index.html';
379
+ content: var(--tw-content);
380
+ }
381
+ .content-\\[\\'project-a\\/node_modules\\/my-lib-2\\/src\\/index\\.html\\'\\] {
382
+ --tw-content: 'project-a/node modules/my-lib-2/src/index.html';
383
+ content: var(--tw-content);
384
+ }
385
+ .content-\\[\\'project-a\\/src\\/logo\\.jpg\\'\\] {
386
+ --tw-content: 'project-a/src/logo.jpg';
387
+ content: var(--tw-content);
388
+ }
389
+ .content-\\[\\'project-b\\/src\\/index\\.html\\'\\] {
390
+ --tw-content: 'project-b/src/index.html';
391
+ content: var(--tw-content);
392
+ }
393
+ .content-\\[\\'project-c\\/src\\/index\\.html\\'\\] {
394
+ --tw-content: 'project-c/src/index.html';
395
+ content: var(--tw-content);
396
+ }
397
+ @supports (-moz-orient: inline) {
398
+ @layer base {
399
+ *, ::before, ::after, ::backdrop {
400
+ --tw-content: "";
403
401
}
404
402
}
405
- @property --tw-content {
406
- syntax: "*";
407
- inherits: false ;
408
- initial-value: "" ;
409
- }
410
- "
411
- ` )
412
- } ,
413
- )
414
- } )
403
+ }
404
+ @property --tw-content {
405
+ syntax: "*" ;
406
+ inherits: false ;
407
+ initial-value: "";
408
+ }
409
+ "
410
+ ` )
411
+ } ,
412
+ )
0 commit comments