Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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