-
-
Notifications
You must be signed in to change notification settings - Fork 245
Support for within brackets [] styles #475
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
Comments
@theasteve did you found any solution for this? |
@webmaster1986 yes, although not a great solutioninstead of adding the REGEX I just passed the classes. I also added the use of adding the child elements as well. |
Can you reopen the issue please? Even though you found a work around, the bug still exists, and I think it's important that the repo owners see that this is still an issue for people who do want to whitelist their attribute selectors. |
Exactly related with #303 |
Thanks for the tip. I was thinking about it, but i have so many classes (fonts) that's not really doable. But at least the regexp could be working, if there is no global option for preserving this use case. Stay strong. |
I can confirm I face the same issue migrate from |
The original issue might be related to the selectors being missing in the content. <div class="btn-hello" aria-pressed="false">
<h1>Hello</h1>
</div> [class*=btn-][aria-pressed=false] {
width: 500px;
} works as expected. If anyone has an issue with attributes, could you go to #303 and link to a repo that reproduces the issue, it will help understand what is the issue |
I have the following class being deleted by purgecss:
[class*=btn-][aria-pressed=false]
So I added REGEX to try to avoid to delete the style class from the stylesheet by adding it to the
whitelistPatterns
The REGEX pattern when tested on an online tool seems to work as shown in the image below:

So in theory the regex
/\[(class..btn-)\]\[(aria-[a-z]{7}=([a-z]{5}|[a-z]{4}))\]/
should be preventing the class[class*=btn-][aria-pressed=false]
to be deleted since is added to thewhitelistPatterns
. However, the class is still beind removed from the stylesheet.I wonder if this is due to the
[]
square brackets being used, is there any guidance on how to avoid having that class being removed?this is how is suppose to behave:

but it is being shown like this:

The text was updated successfully, but these errors were encountered: