@@ -349,6 +349,14 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
349
349
return prefixSelector ( tailwindConfig . prefix , selector )
350
350
}
351
351
352
+ function prefixIdentifier ( identifier , options ) {
353
+ if ( identifier === '*' ) {
354
+ return '*'
355
+ }
356
+
357
+ return options . respectPrefix ? context . tailwindConfig . prefix + identifier : identifier
358
+ }
359
+
352
360
return {
353
361
addVariant ( variantName , applyThisVariant , options = { } ) {
354
362
insertInto ( variantList , variantName , options )
@@ -379,13 +387,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
379
387
} ,
380
388
addBase ( base ) {
381
389
for ( let [ identifier , rule ] of withIdentifiers ( base ) ) {
382
- let prefixedIdentifier =
383
- identifier === '*'
384
- ? '*'
385
- : options . respectPrefix
386
- ? context . tailwindConfig . prefix + identifier
387
- : identifier
388
-
390
+ let prefixedIdentifier = prefixIdentifier ( identifier , { } )
389
391
let offset = offsets . base ++
390
392
391
393
if ( ! context . candidateRuleMap . has ( prefixedIdentifier ) ) {
@@ -412,12 +414,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
412
414
)
413
415
414
416
for ( let [ identifier , rule ] of withIdentifiers ( components ) ) {
415
- let prefixedIdentifier =
416
- identifier === '*'
417
- ? '*'
418
- : options . respectPrefix
419
- ? context . tailwindConfig . prefix + identifier
420
- : identifier
417
+ let prefixedIdentifier = prefixIdentifier ( identifier , options )
421
418
let offset = offsets . components ++
422
419
423
420
if ( ! context . candidateRuleMap . has ( prefixedIdentifier ) ) {
@@ -444,12 +441,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
444
441
)
445
442
446
443
for ( let [ identifier , rule ] of withIdentifiers ( utilities ) ) {
447
- let prefixedIdentifier =
448
- identifier === '*'
449
- ? '*'
450
- : options . respectPrefix
451
- ? context . tailwindConfig . prefix + identifier
452
- : identifier
444
+ let prefixedIdentifier = prefixIdentifier ( identifier , options )
453
445
let offset = offsets . utilities ++
454
446
455
447
if ( ! context . candidateRuleMap . has ( prefixedIdentifier ) ) {
@@ -465,12 +457,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
465
457
let offset = offsets . base ++
466
458
467
459
for ( let identifier in base ) {
468
- let prefixedIdentifier =
469
- identifier === '*'
470
- ? '*'
471
- : options . respectPrefix
472
- ? context . tailwindConfig . prefix + identifier
473
- : identifier
460
+ let prefixedIdentifier = prefixIdentifier ( identifier , options )
474
461
let value = [ ] . concat ( base [ identifier ] )
475
462
476
463
let withOffsets = value . map ( ( rule ) => [ { sort : offset , layer : 'base' } , rule ] )
@@ -495,13 +482,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
495
482
let offset = offsets . utilities ++
496
483
497
484
for ( let identifier in utilities ) {
498
- let prefixedIdentifier =
499
- identifier === '*'
500
- ? '*'
501
- : options . respectPrefix
502
- ? context . tailwindConfig . prefix + identifier
503
- : identifier
504
-
485
+ let prefixedIdentifier = prefixIdentifier ( identifier , options )
505
486
let value = [ ] . concat ( utilities [ identifier ] )
506
487
507
488
let withOffsets = value . map ( ( rule ) => [ { sort : offset , layer : 'utilities' , options } , rule ] )
0 commit comments