vite-minify-css-module

πŸ“¦ πŸ“¦ unplugin minify css module
2,293
Install
npm install vite-minify-css-module
Latest Version:1.0.3
Vue:3
License:MIT
Last Updated:Dec 28, 2023
Links: npm
Maintainer: hunghg255

πŸ“¦ vite-minify-css-module

NPM version

🌈 Features
  • 🍰 Minify css module class name
  • 🍰 Support clean-css options

πŸ“¦ Installation

npm i vite-minify-css-module@latest -D
support vite and rollup.
Basic
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import MinifyCssModule from 'vite-minify-css-module/vite';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    MinifyCssModule({
      cleanCSS: {
        level: {
          2: {
            mergeSemantically: true,
            restructureRules: true,
          },
        },
      },
    }),
  ],
});


🌸 DefaultConfiguration

export interface PluginOptions {
  dictionary?: string;
  clearnCSS?: OptionsOutput;
}

How does it work?

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 HERE */
}

._card_pzatx_32 {
  /* CSS HERE */
}

._back_pzatx_49 ._content_pzatx_70 ._close_pzatx_74 {
  /* CSS HERE */
}

By using this module, the smalles possible classname will be used for each "id":

@keyframes a {
  /* CSS HERE */
}

.v {
  /* CSS HERE */
}

.c .s .w {
  /* CSS HERE */
}

Related Packages

vite-console-debug

πŸ“¦ πŸ“¦ unplugin console debug

902
unplugin-vue-named-export

Named export for Vue SFC.

9,463 22
vite-plugin-resize-image

πŸ“¦ πŸ“¦ unplugin compression Image Compression plugin based on squoosh and sharp

682
unplugin-lightningcss

Lightning CSS integration for Vite, Rollup, esbuild, Webpack, Vue CLI, and more.

1,880,181 29

Version History

Version Released Vue License
1.0.3 ^3.0 MIT
1.0.2 ^3.0 MIT
1.0.1 ^3.0 MIT
1.0.0 ^3.0 MIT