Fix usage of special-character prefixes (#8772)

* Fix import

* Support arbitrary prefixes

* Add test

* Update changelog
This commit is contained in:
Jordan Pittman 2022-07-04 14:42:27 -04:00 • committed by GitHub
parent c8c4852b87
commit 5191ec1c00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 125 additions and 1 deletions

View file

@ -1,4 +1,4 @@
import { flagEnabled } from '../featureFlags.js'
import { flagEnabled } from '../featureFlags'
import * as regex from './regex'
export function defaultExtractor(context) {
@ -22,6 +22,10 @@ export function defaultExtractor(context) {
function* buildRegExps(context) {
let separator = context.tailwindConfig.separator
let variantGroupingEnabled = flagEnabled(context.tailwindConfig, 'variantGrouping')
let prefix =
context.tailwindConfig.prefix !== ''
? regex.optional(regex.pattern([/-?/, regex.escape(context.tailwindConfig.prefix)]))
: ''
let utility = regex.any([
// Arbitrary properties
@ -88,6 +92,8 @@ function* buildRegExps(context) {
// Important (optional)
/!?/,
prefix,
variantGroupingEnabled
? regex.any([
// Or any of those things but grouped separated by commas