bdkjones / CodeKit

CodeKit 3 Issue Tracker
https://codekitapp.com
82 stars 5 forks source link

PurgeCSS wrongly removes all Tailwind-style colon classes #696

Open timjuedemann opened 2 years ago

timjuedemann commented 2 years ago

Quick, short summary: PurgeCSS wrongly removes all classes containing the colon character (i.e. md:w-6) despite them being in use. Could this be due to the colon character being escaped in the actual stylesheet (i.e. .md\:w-6)?

Expected results: PurgeCSS removes only the colon classes not used in the scanned content.

Actual results: PurgeCSS removes all colon classes regardless if they’re being used or not.

Exact steps to reproduce:

  1. Add colon classes in SCSS (they compile correctly when PurgeCSS is deactivated)
  2. Assign colon classes to content (PHP in my case)
  3. Compile with PurgeCSS activated
  4. PurgeCSS removes all colon classes despite some of them having been assigned in the content. Non-colon classes are removed correctly/as expected.

Your configuration (any details about your system that you think might be relevant) CodeKit 3.16.1

bdkjones commented 2 years ago

This sounds like a PurgeCSS issue. But regardless, Tailwind no longer uses PurgeCSS; the JIT Tailwind compiler assembles only the CSS you need. As long as you've installed the latest version of Tailwind, you're using the JIT approach and should not have PurgeCSS enabled.

timjuedemann commented 2 years ago

Sorry, my wording might have been somewhat imprecise there – I am not actually using Tailwind but creating utility classes mimicking the Tailwind syntax. That being said, I came across this thread offering a solution. Is it possible to point the PurgeCSS version that ships with CodeKit to a custom config file?

marcomourao commented 1 year ago

I would also love the possibility to use a custom config file or at least a field to just put the regex for a custom extractor.