This repository demonstrates an uncommon bug encountered when using PurgeCSS with Tailwind CSS in a production build. Despite following best practices, PurgeCSS failed to remove several unused styles, resulting in a significantly larger CSS file than expected. This impacted performance and increased load times.
The bug.js
file contains the problematic code that leads to this behavior. bugSolution.js
illustrates the correction implemented to solve the issue.
Problem: PurgeCSS, despite configuration, did not accurately remove unused Tailwind CSS classes from the production build, inflating the final CSS output.
Solution: The solution involves careful review of PurgeCSS configuration and ensuring all necessary directives and content are properly handled to guarantee accurate unused style removal. Additionally, it may require debugging your usage of Tailwind styles to pinpoint any potential errors causing incorrect behavior.