Tailwindcss: Update default extractor for purgeCSS to account for escaped class names

Created on 10 Sep 2020  路  1Comment  路  Source: tailwindlabs/tailwindcss

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.

Most helpful comment

Fixed in 1.8.7 馃憤

>All comments

Fixed in 1.8.7 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chintanbanugaria picture chintanbanugaria  路  3Comments

jbardnz picture jbardnz  路  3Comments

spyric picture spyric  路  3Comments

Quineone picture Quineone  路  3Comments

paulhuisman picture paulhuisman  路  3Comments