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

Update default extractor for purgeCSS to account for escaped class names #2360

Closed
ronaldcurtis opened this issue Sep 10, 2020 · 1 comment · Fixed by #2364
Closed

Update default extractor for purgeCSS to account for escaped class names #2360

ronaldcurtis opened this issue Sep 10, 2020 · 1 comment · Fixed by #2364

Comments

@ronaldcurtis
Copy link

Describe the problem:

Not sure if this is a bug or a feature request, but I just noticed that the default extractor for purgeCSS does not extract class names that have been escaped. For example, in translation JSON files, we have a need to include html elements as such:

{
  "helloThere": "Hello there, <span class=\"whitespace-no-wrap\">Mr. Jones</span>"
}

But it seems like the patterns used in the default extractor don't collect these class names properly. Using a Regex tester, it looks like the final \ is also included:

image

I guess it's not too much of a problem, as one can just add another extractor for JSON files. But it took as a while to figure out the work around, so it might help others in the future if the patterns could also account for escaped strings.

@adamwathan
Copy link
Member

Fixed in 1.8.7 👍

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

Successfully merging a pull request may close this issue.

2 participants