Skip to content

Commit 6b4fc0c

Browse files
committed
Fix Readme
1 parent 46c1c60 commit 6b4fc0c

File tree

3 files changed

+40
-36
lines changed

3 files changed

+40
-36
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Svelte preprocess CSS Modules, changelog
22

3+
## 2.1.1 (Oct 27, 2021)
4+
5+
- Fix readme
6+
37
## 2.1.0 (Oct 20, 2021)
48
### Features
59
- SvelteKit support

README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,41 @@ function getLocalIdent(
570570
}
571571
```
572572

573+
574+
*Example of use*
575+
576+
```bash
577+
# Directory
578+
SvelteApp
579+
└─ src
580+
├─ App.svelte
581+
└─ components
582+
└─ Button.svelte
583+
```
584+
```html
585+
<!-- Button.svelte -->
586+
<button class="red">Ok</button>
587+
588+
<style>
589+
.red { background-color: red; }
590+
</style>
591+
```
592+
593+
```js
594+
// Preprocess config
595+
...
596+
preprocess: [
597+
cssModules({
598+
localIdentName: '[path][name]__[local]',
599+
getLocalIdent: (context, { interpolatedName }) => {
600+
return interpolatedName.toLowerCase().replace('src_', '');
601+
// svelteapp_components_button__red;
602+
}
603+
})
604+
],
605+
...
606+
```
607+
573608
**`hashSeeder`**
574609

575610
Set the source to create the hash from (when using `[hash]` / `[contenthash]`).
@@ -645,41 +680,6 @@ preprocess: [
645680
</style>
646681
```
647682

648-
649-
*Example of use*
650-
651-
```bash
652-
# Directory
653-
SvelteApp
654-
└─ src
655-
├─ App.svelte
656-
└─ components
657-
└─ Button.svelte
658-
```
659-
```html
660-
<!-- Button.svelte -->
661-
<button class="red">Ok</button>
662-
663-
<style>
664-
.red { background-color: red; }
665-
</style>
666-
```
667-
668-
```js
669-
// Preprocess config
670-
...
671-
preprocess: [
672-
cssModules({
673-
localIdentName: '[path][name]__[local]',
674-
getLocalIdent: (context, { interpolatedName }) => {
675-
return interpolatedName.toLowerCase().replace('src_', '');
676-
// svelteapp_components_button__red;
677-
}
678-
})
679-
],
680-
...
681-
```
682-
683683
**`localIdentName`**
684684

685685
Inspired by [webpack interpolateName](https://github.com/webpack/loader-utils#interpolatename), here is the list of tokens:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte-preprocess-cssmodules",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "Svelte preprocessor to generate CSS Modules classname on Svelte components",
55
"keywords": [
66
"svelte",

0 commit comments

Comments
 (0)