Skip to content

Commit 36164e1

Browse files
author
Michael Vurchio
committed
Update *directives* section on Readme
1 parent 75455f2 commit 36164e1

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

CHANGELOG.md

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

3-
## 1.3.0 (Nov 20, 2020)
3+
## 1.3.0 (Nov 22, 2020)
44
- Feature: CSS Modules from imports
5-
- Fix: *global selector* Regex is now working with an attached bracket to the selector (missing space) `.myclass{ }`
5+
- Fix: *global selector* Regex is now working with an attached bracket to the selector (missing space was throwing an error) `.myclass{ }`
66
- Dev: use of typescript, set up eslint and prettier
77

88
## 1.2.1 (Oct 31, 2020)

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Generate CSS Modules classname on Svelte components
2121
- [Destructuring import](#destructuring-import)
2222
- [kebab-case situation](#kebab-case-situation)
2323
- [Unnamed import](#unnamed-import)
24-
- [Avoid class directive](#avoid-class-directive)
24+
- [Directive and dynamic classes](#directive-and-dynamic-classes)
2525
- [Code example](#code-example)
2626
- [Why CSS Modules on Svelte](#why-css-modules-on-svelte)
2727

@@ -505,8 +505,10 @@ p { font-size: 18px; }
505505
<p class="svelte-vg78j0">My error message</p>
506506
```
507507

508-
### Avoid class directive
509-
The Svelte's builtin `class:` directive is **not working** with import cssModules because they are dynamics. **Use JS syntax instead**
508+
### Directive and Dynamic classes
509+
510+
Use the Svelte's builtin `class:` directive or javascript template to display a class dynamically.
511+
**Note**: the *shorthand directive* is **NOT working** with CSS Modules.
510512

511513
```html
512514
<script>
@@ -518,13 +520,15 @@ The Svelte's builtin `class:` directive is **not working** with import cssModule
518520

519521
<button on:click={() => isSuccess = !isSuccess}>Toggle</button>
520522

521-
<!-- NOT WORKING -->
522-
<p class:success={isSuccess} class:error={!isSuccess}>Notice</p>
523+
<!-- Error -->
524+
<p class:success>Success</p>
523525

524-
<!-- OK -->
525-
<p class={notice}>Notice</p>
526+
<!-- Ok -->
527+
<p
528+
class:success={isSuccess}
529+
class:error={!isSuccess}>Notice</p>
526530

527-
<!-- OK -->
531+
<p class={notice}>Notice</p>
528532
<p class={isSuccess ? success : error}>Notice</p>
529533
```
530534

0 commit comments

Comments
 (0)