Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
vite-plugin-optimize-css-modules
Advanced tools
Mangles the classnames generated by postcss-modules in vite
Vite Plugin - Optimize CSS Modules
Mangle classnames in production - save up to 20% on css for free!
This plugin requires vite of v3 or greater. It only makes sense to use if you're using css modules.
$ npm install --save-dev vite-plugin-optimize-css-modules
In your vite.config.ts
simply add the plugin:
import { optimizeCssModules } from 'vite-plugin-optimize-css-modules';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [
optimizeCssModules()
]
})
And that's it. When running vite build
your generated CSS should be significantly smaller.
By default, when using css modules, you end up with hashes or other long class-names in your bundled css files:
@keyframes _close-card_pzatx_1 {
/* ...css */
}
._card_pzatx_32 {
/* ...css */
}
._back_pzatx_49 ._content_pzatx_70 ._close_pzatx_74 {
/* ...css */
}
By using this module, the smalles possible classname will be used for each "id":
@keyframes a {
/* ...css */
}
.v {
/* ...css */
}
.c .s .w {
/* ...css */
}
FAQs
Mangles the classnames generated by postcss-modules in vite
The npm package vite-plugin-optimize-css-modules receives a total of 11,428 weekly downloads. As such, vite-plugin-optimize-css-modules popularity was classified as popular.
We found that vite-plugin-optimize-css-modules demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.