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

PurgeCSS remove first components class when using whitelist comment #2258

Closed
florianbouvot opened this issue Aug 27, 2020 · 3 comments · Fixed by #2331
Closed

PurgeCSS remove first components class when using whitelist comment #2258

florianbouvot opened this issue Aug 27, 2020 · 3 comments · Fixed by #2331

Comments

@florianbouvot
Copy link
Contributor

florianbouvot commented Aug 27, 2020

Hi tailwindlabs team,

I noticed the following point with the building PurgeCSS.

If I import a CSS file before @tailwind components; and use PurgeCSS whitelist comment: .container classes are remove but not responsive container classes.

My Sass file

@tailwind base;

/* purgecss start ignore */
@import "button";
/* purgecss end ignore */

@tailwind components;

@tailwind utilities;

I make different test using exclamation mark in comment, ... same result

I use last tailwindcss 1.7.5, sass, csso.

My tailwind.config.js

module.exports = {
  purge: [
    'path/to/templates',
  ],
  future: {
    removeDeprecatedGapUtilities: true,
  },
  experimental: {
    applyComplexClasses: true,
    uniformColorPalette: true,
    extendedSpacingScale: true,
    defaultLineHeights: true,
    extendedFontSizeScale: true,
  },
}
@florianbouvot florianbouvot changed the title PurgeCSS vs components PurgeCSS remove some tailwind components classes Aug 27, 2020
@florianbouvot
Copy link
Contributor Author

florianbouvot commented Aug 27, 2020

I can use mode: all + PurgeCSS comment as a work around.

@florianbouvot florianbouvot changed the title PurgeCSS remove some tailwind components classes PurgeCSS remove first components class when using comment Aug 27, 2020
@florianbouvot florianbouvot changed the title PurgeCSS remove first components class when using comment PurgeCSS remove first components class when using whitelist comment Aug 27, 2020
@adamwathan
Copy link
Member

Can you create a simple project that reproduces the issue? We got a lot of issues that require me to manually recreate someone's project from scratch and I unfortunately just don't have time for that so things end up going unfixed. If you can provide something I can clone and start troubleshooting with right away it's much easier for me to find time to diagnose and fix the issue.

@adamwathan
Copy link
Member

Was able to reproduce this but realizing it sort of doesn't make sense to configure things this way. Using your config, your custom button styles are already protected from purging, because only the @tailwind utilities block gets purged, so the comments are redundant.

I agree this shouldn't break the way it is and we should handle it more gracefully or fail with a clear error, but in the mean time just delete those comments and you're good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants