diff --git a/packages/tailwindcss/src/theme.ts b/packages/tailwindcss/src/theme.ts index 77f216a8aef8..ba280ac36b16 100644 --- a/packages/tailwindcss/src/theme.ts +++ b/packages/tailwindcss/src/theme.ts @@ -1,6 +1,8 @@ import type { AtRule } from './ast' import { escape } from './utils/escape' +const ESCAPED_STAR_REGEX = /-\\\*$/ + export const enum ThemeOptions { NONE = 0, INLINE = 1 << 0, @@ -41,9 +43,7 @@ export class Theme { ) {} add(key: string, value: string, options = ThemeOptions.NONE): void { - if (key.endsWith('-\\*')) { - key = key.replace(/-\\\*$/, '-*') - } + key = key.replace(ESCAPED_STAR_REGEX, '-*') if (key.endsWith('-*')) { if (value !== 'initial') {