Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative classes not matched by pattern safelisting #6476

Closed
mwnciau opened this issue Dec 13, 2021 · 1 comment
Closed

Negative classes not matched by pattern safelisting #6476

mwnciau opened this issue Dec 13, 2021 · 1 comment

Comments

@mwnciau
Copy link
Contributor

mwnciau commented Dec 13, 2021

What version of Tailwind CSS are you using?

v3.0.2

What build tool (or framework if it abstracts the build tool) are you using?

postcss-cli 9.1.0

What version of Node.js are you using?

v14.16.1

What browser are you using?

n/a

What operating system are you using?

Windows 10

Reproduction URL

n/a

Describe your issue

Pattern safelisting, introduced in #5511, allows you to use regular expressions to match classes to whitelist. E.g. an overly simple regex to match the "top-1" class:

{
    pattern: /^top-1$/,
}

This will produce a css file with the "top-1" class, as expected. However, I cannot get this to work with negative values.

{
    pattern: /^-top-1$/,
}

This should produce a css file with the "-top-1" class, but this class is not in the resulting css file. It works fine, however, when not using pattern safelisting:

safelist: [
    "-top-1",
    {
        pattern: /-top-2/,
    }
]

The above produces a css file with the "-top-1" class, but not the "-top-2" class.

I wondered if it could be a variant, but the documentation for variants is particularly sparse so I also tried the below with no success.

{
    pattern: /^top-1$/,
    variants: ['-'],
}

{
    pattern: /^top-1$/,
    variants: ['negative'],
}
@mwnciau
Copy link
Contributor Author

mwnciau commented Dec 15, 2021

Fixed in #6480

@mwnciau mwnciau closed this as completed Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant