resolveConfig not respecting PurgeCSS rules #2554
strewhella
started this conversation in
Ideas
Replies: 2 comments 3 replies
-
Hey @strewhella 👋 Are you able to create a little minimal GitHub repo where you can demonstrate this problem, so we can have a look at it? |
Beta Was this translation helpful? Give feedback.
1 reply
-
PurgeCSS is for purging your CSS files, not your Tailwind config. Your resolved config will always be the complete resolved config, which is intentional. I recommend using a project like babel-preval to flatten the config at build time and avoid pulling in lodash and stuff, that’s what we do in our own projects. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've just started a new project using Tailwind (great tool!). I was inspecting bundle sizes of a fresh Create React App install with Tailwind and finding that importing the config into my JS (https://tailwindcss.com/docs/configuration#referencing-in-java-script) with
resolveConfig
contributed 58.31KB of JavaScript, even with PurgeCSS configured and all but 1 class stripped out.This is mostly lodash it seems, so I worked around this by writing out the
theme
into a separate JSON file. However, this JSON file writes out the entire theme, not the purged version following the PurgeCSS rules. Is it possible to also purge this JS version of the theme?Beta Was this translation helpful? Give feedback.
All reactions