@vdegenne/vite-plugin-css-modules 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/readme.md +25 -0
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@vdegenne/vite-plugin-css-modules",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
+ "types": "./types.d.ts",
5
6
  "exports": {
6
7
  ".": {
7
8
  "import": "./lib/index.js",
8
9
  "types": "./lib/index.d.ts"
9
10
  }
10
11
  },
11
- "types": "./types.d.ts",
12
12
  "scripts": {
13
13
  "build": "wireit"
14
14
  },
package/readme.md ADDED
@@ -0,0 +1,25 @@
1
+ ## Installation
2
+
3
+ ```
4
+ npm i -D @vdegenne/vite-plugin-css-modules
5
+ ```
6
+
7
+ ## Usage
8
+
9
+ Add the plugin to vite
10
+
11
+ ```js
12
+ import {cssModules} from '@vdegenne/vite-plugin-css-modules'
13
+
14
+ plugins: [cssModules()]
15
+ ```
16
+
17
+ Then in your code importing a stylesheet like that
18
+
19
+ ```js
20
+ import styles from './stylesheet.css' with {type: 'css'}
21
+ ```
22
+
23
+ will resolve the import to a CSSStyleSheet containing the style defined in the file.
24
+
25
+ Add `@vdegenne/vite-plugin-css-modules` in `tsconfig.json` types to override vite `"*.css"` imports if you need.