-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow overriding purgecss options #370
Conversation
Hey @gavar thanks for the PR, I don't know how I feel about this, wouldn't this make it more fuzzy ? IMO, this defeats the purpose of purging CSS, if the content of any tags contains any words that mtaches with a css class name, that css class won't be purged ? |
@the-dijkstra thanks, it does make sense! I'll refine a regex to include only class names. At the moment, I wasn't able to use astro-purgecss` as it was removing classes that were actually necessary. |
@gavar I think I need to refactor the options to allow for passing extra extractors, to allow for people using tailwind to customize the logic. |
@the-dijkstra I've updated the configuration to allow overriding any PurgeCSS option but preserved the logic of merging |
Hey @gavar thanks for the changes 🙏 , I will merge this if you can please add the relevant changeset. pnpm run changeset Or if you are using npm run changeset Note: This should be a minor version bump. |
Thanks, @the-dijkstra. I hope the changeset has been generated correctly. I'm not sure how to enforce a minor version change, so I've altered the last commit to specify a 'minor' change bump manually. |
Hey @gavar thanks for taking the time to make this PR 🙏 |
this pull request updates purgecss regex to avoid deleting styles that are actually in use.
https://v2.tailwindcss.com/docs/optimizing-for-production#writing-purgeable-html
UPDATE:
it was decided to allow providing custom options to override existing ones instead of introducing a breaking change