Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wangzongming/vite-plugin-css-modules
vite projects to support can use css modules, Not just .module.xxx
https://github.com/wangzongming/vite-plugin-css-modules
vite vite-plugin-css-modules
Last synced: 19 days ago
JSON representation
vite projects to support can use css modules, Not just .module.xxx
- Host: GitHub
- URL: https://github.com/wangzongming/vite-plugin-css-modules
- Owner: wangzongming
- Created: 2021-09-17T02:42:39.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-15T01:03:13.000Z (6 months ago)
- Last Synced: 2024-10-11T15:12:02.118Z (about 1 month ago)
- Topics: vite, vite-plugin-css-modules
- Language: TypeScript
- Homepage:
- Size: 9.77 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# vite-plugin-css-modules
[![npm](https://img.shields.io/npm/v/vite-plugin-css-modules.svg)](https://www.npmjs.com/package/vite-plugin-css-modules)
Make all style files supported css module, not just xxx.module.xxx
## Install
```
npm i vite-plugin-css-modules | yarn add vite-plugin-css-modules
```## Usage
```ts
import vitePluginCssModules from "vite-plugin-css-modules";export default {
plugins: [vitePluginCssModules()],
};
```## Options
### precompilers [optional]
Precompiler configuration for various style files. Plug-in built-in less type file compilation configuration
eg: less
vitePluginCssModules({
precompilers:[
{
regExp: /.(less)$/,
// Self-handling compilation
ompiler: async (code, file) => {
const cssCode = (
await nodeLess.render(code, {
syncImport: true,
javascriptEnabled: true,
})
).css;
return cssCode
}
}
]
}),### postcssPlugins [optional]
postcss plugins config, see also postcss
### postcssModulesOpts [optional]
postcss-modules plugins config, see also postcss-modules