-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Add Purgecss to with-tailwindcss example #9145
Conversation
Stats from current PRDefault Server ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Rendered Page Sizes
Serverless ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Serverless bundles
Commit: eccadd6 |
How does this work for HTML classes that are dynamically composed? |
It won't work with dynamically composed classes. Purgecss is "dumb" and simply looks for a matching string. Here's what the docs say about that issue: What do you think the best path forward is? Should I create a separate example that uses Purgecss instead of baking it into this example? |
I'm OK with it being in the example as long as we explicitly call out this restriction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Hi @taylorbryant, thanks for the example and PR! One issue having just used it in familiarising myself with tailwindcss - the dependency on purgecss in development breaks auto-reloading of styles. The docs themselves recommend only depending on it in production, (and adding it as the last dependency, though not sure why this is important): https://tailwindcss.com/docs/controlling-file-size/
Is it possible to push a commit to this PR to merge again, or create a new one? |
I've just modified your example
|
By default, Tailwind CSS generates a stylesheet that’s 477.6kb. To combat the large file size, Tailwind CSS recommends using Purgecss.
This PR:
@fullhuman/postcss-purgecss
as a dependencycssnano
to the list of PostCSS plugins; it's in thepackage.json
, but it wasn't being used