-
-
Notifications
You must be signed in to change notification settings - Fork 378
Updated Vite to properly setup PostCSS with PurgeCSS for removing all unused styles on build. #367
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
base: main
Are you sure you want to change the base?
Conversation
…ing all unused styles on build.
vite/postcss.config.cjs
Outdated
| // `${bootstrap}/js/dist/collapse.js`, | ||
| // `${bootstrap}/js/dist/dropdown.js`, | ||
| // `${bootstrap}/js/dist/modal.js`, | ||
| `${bootstrap}/js/dist/offcanvas.js`, |
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.
Not sure this is a good default solution. One needs to know what to keep and what not.
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.
We could use the entire bootstrap Javascript file but it increases the output size by a few kilobytes.
We can use this
bootstrap/dist/us/bootstrap.bundle.js
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.
I introduced flexibility for users by allowing them to selectively include individual JS modules or opt for the entire Bootstrap bundle JS. This gives users the option to tailor their build based on their specific module requirements.
Reverted the inclusion fo type: module setting made in vite.config.js Additionally, I introduced flexibility for users by allowing them to selectively include individual JS modules or opt for the entire Bootstrap bundle JS. This gives users the option to tailor their build based on their specific module requirements. This approach aims to enhance user experience and provides more control over the project configuration.
Changes Made:
This pull request introduces crucial updates to enhance the project's build process. Specifically, I have forked the repository and implemented an updated configuration for Vite to seamlessly integrate PostCSS with PurgeCSS. This ensures that only necessary styles are included in the final build, significantly reducing the overall file size and improving performance.
Testing
I have thoroughly tested these changes to ensure compatibility with the existing codebase. The project builds successfully, and I have verified that the application functions as expected with the updated styling.