Skip to content

Commit 05e3139

Browse files
author
Michael Vurchio
committed
Simplify example
1 parent 1acef43 commit 05e3139

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

README.md

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Pass an object of the following properties
6767
| `includePaths` | `{Array}` | `[]` (Any) | An array of paths to be processed |
6868
| `getLocalIdent` | `Function` | `undefined` | Generate the classname by specifying a function instead of using the built-in interpolation |
6969

70-
### `getLocalIdent`
70+
#### `getLocalIdent`
7171

7272
Function to generate the classname instead of the built-in function.
7373

@@ -113,26 +113,15 @@ SvelteApp
113113
```js
114114
// Preprocess config
115115
...
116-
preprocess: [
117-
cssModules({
118-
localIdentName: '[path][name]__[local]',
119-
getLocalIdent: (
120-
{
121-
context, // SvelteApp/src/components
122-
resourcePath // SvelteApp/src/components/Button.svelte
123-
},
124-
{
125-
template, // [path][name]__[local]
126-
interpolatedName // SvelteApp_src_components_Button__red
127-
},
128-
className, // red
129-
{ style } // <style>.red { background-color: red; }</style>
130-
) => {
131-
return interpolatedName.toLowerCase().replace('src_', '');
132-
// svelteapp_components_button__red;
133-
}
134-
})
135-
],
116+
preprocess: [
117+
cssModules({
118+
localIdentName: '[path][name]__[local]',
119+
getLocalIdent: ( context, { interpolatedName }) => {
120+
return interpolatedName.toLowerCase().replace('src_', '');
121+
// svelteapp_components_button__red;
122+
}
123+
})
124+
],
136125
...
137126
```
138127

0 commit comments

Comments
 (0)