Andy-set-studio / gorko

A tiny Sass token class generator.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gorko classes stripped by PurgeCSS

robdodson opened this issue · comments

This is actually an issue with PurgeCSS but I wanted to post the problem and solution here in case others run across it.

PurgeCSS will ignore classes with a : in their name, which Gorko uses for its responsive class names. The solution I came across was to use the regex recommended in the Tailwind docs which is more permissive and looks for :, as well as some other special characters.

In your PurgeCSS config do:

defaultExtractor: content => {
  // Capture as liberally as possible, including things like `lg\:display-none`
  // https://tailwindcss.com/docs/controlling-file-size#understanding-the-regex
  return content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || [];
},