You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`classnameTransform`|`asIs`| See [`classnameTransform`](#classnameTransform) below. |
75
+
|`customMatcher`|`"\\.module\\.(c\|le\|sa\|sc)ss$"`| Changes the file extensions that this plugin processes. |
76
+
|`customRenderer`|`false`| See [`customRenderer`](#customRenderer) below. |
77
+
|`customTypescriptTransformer`|`false`| See [`customTypescriptTransformer`](#customTypescriptTransformer) below. |
78
+
|`dotenvOptions`|`{}`| Provides options for [`dotenv`](https://github.com/motdotla/dotenv#options). |
79
+
|`postCssOptions`|`{}`| See [`postCssOptions`](#postCssOptions) below. |
80
+
|`rendererOptions`|`{}`| See [`rendererOptions`](#rendererOptions) below. |
80
81
81
82
```json
82
83
{
@@ -112,7 +113,7 @@ When a custom renderer is provided, not other renderers will be used.
112
113
113
114
The path to the `customRenderer` must be relative to the project root (i.e. `./myRenderer.js`).
114
115
115
-
The custom renderer itself should be a JavaScript file. The function will be called with two arguments: a `css` string, and an `options` object (see [`options.ts`](https://github.com/mrmckeb/typescript-plugin-css-modules/blob/master/src/options.ts#L36-L39)). It must be synchronous, and must return valid CSS.
116
+
The custom renderer itself should be a JavaScript file. The function will be called with two arguments: a `css` string, and an `options` object (see [`options.ts`](https://github.com/mrmckeb/typescript-plugin-css-modules/blob/master/src/options.ts#L33-L41)). It must be synchronous, and must return valid CSS.
116
117
117
118
```js
118
119
module.exports= (css, { fileName, logger }) => {
@@ -129,6 +130,33 @@ You can find an example custom renderer in our test fixtures ([`customRenderer.j
129
130
130
131
The [internal `logger`](https://github.com/mrmckeb/typescript-plugin-css-modules/blob/master/src/helpers/logger.ts) is provided for [debugging](#troubleshooting).
131
132
133
+
#### `customTypescriptTransformer`
134
+
135
+
The `customTypescriptTransformer` is an advanced option, letting you provide a transformer of the generated typescript declarations.
136
+
137
+
When a custom typescript transformer is provided, its output is used as the virtual typescript file.
138
+
139
+
The path to the `customTypescriptTransformer` must be relative to the project root (i.e. `./myTypescriptTransformer.js`).
140
+
141
+
The custom renderer itself should be a JavaScript file. The function will be called with two arguments: a `dts` string, and an `options` object (see [`options.ts`](https://github.com/mrmckeb/typescript-plugin-css-modules/blob/master/src/options.ts#L43-L52)). It must be synchronous, and must return valid TypeScript Declaration code (code found in a .d.ts file only).
You can find an example custom typescript transformer in our test fixtures ([`customTypescriptTransformer.js`](https://github.com/mrmckeb/typescript-plugin-css-modules/blob/master/src/helpers/__tests__/fixtures/customTypescriptTransformer.js)).
155
+
156
+
The [internal `logger`](https://github.com/mrmckeb/typescript-plugin-css-modules/blob/master/src/helpers/logger.ts) is provided for [debugging](#troubleshooting).
157
+
158
+
The `classes` object represents all the classnames extracted form the CSS Module. They are available if you want to add a custom representation of the CSS classes.
0 commit comments