Skip to content

Commit 57f505a

Browse files
author
Michael Vurchio
committed
Bump version, update Readme, add Changelog
1 parent caa0347 commit 57f505a

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

CHANGELOG.md

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

3-
## 1.2.0 (Sept 21, 2020)
3+
## 1.2.1 (Oct 31, 2020)
4+
- Fix class chaining and pseudo selector [pull request #8](https://github.com/micantoine/svelte-preprocess-cssmodules/pull/8)
5+
6+
## 1.2.0 (Sept 21, 2020)
47
- Add support for `getLocalIdent()` [issue #6](https://github.com/micantoine/svelte-preprocess-cssmodules/issues/6) - [pull request #7](https://github.com/micantoine/svelte-preprocess-cssmodules/pull/7)
58

69
## 1.1.1

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ Pass an object of the following properties
6666
| `localIdentName` | `{String}` | `"[local]-[hash:base64:6]"` | A rule using any available token from [webpack interpolateName](https://github.com/webpack/loader-utils#interpolatename) |
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 |
69-
| `strict` | `Boolean` | `false` | When true, an exception is raised when a class is used while not being defined in `<style>`
69+
| `strict` | `{Boolean}` | `false` | When true, an exception is raised when a class is used while not being defined in `<style>`
7070

7171
#### `getLocalIdent`
7272

73-
Function to generate the classname instead of the built-in function.
73+
Function to generate the classname instead of relying on the built-in function.
7474

7575
```js
7676
function getLocalIdent(
@@ -150,7 +150,7 @@ The component will be transformed to
150150

151151
### Replace only the required class
152152

153-
CSS Modules classname are generated to the html class values prefixed by `$style.`. The rest is left untouched.
153+
CSS Modules classname are generated to the html class values prefixed by `$style.`. The rest is left untouched and will use the default svelte scoped class.
154154

155155
*Before*
156156

@@ -169,18 +169,18 @@ CSS Modules classname are generated to the html class values prefixed by `$style
169169

170170
```html
171171
<style>
172-
.blue { color: blue;}
172+
.blue.svelte-1s2ez3w { color: blue;}
173173
.red-2iBDzf { color: red; }
174-
.text-center { text-align: center; }
174+
.text-center.svelte-1s2ez3w { text-align: center; }
175175
</style>
176176

177-
<p class="blue text-center">My blue text</p>
178-
<p class="red-2iBDzf text-center">My red text</p>
177+
<p class="blue text-center svelte-1s2ez3w">My blue text</p>
178+
<p class="red-2iBDzf text-center svelte-1s2ez3w">My red text</p>
179179
```
180180

181181
### Remove unspecified class
182182

183-
If a CSS Modules class has no css style attached, it will be removed from the class attribute.
183+
On non strict mode, if a CSS Modules class has no css style attached, it will be removed from the class attribute.
184184

185185
*Before*
186186

@@ -196,10 +196,10 @@ If a CSS Modules class has no css style attached, it will be removed from the cl
196196

197197
```html
198198
<style>
199-
.text-center { text-align: center; }
199+
.text-center.svelte-1s2ez3w { text-align: center; }
200200
</style>
201201

202-
<p class="text-center">My blue text</p>
202+
<p class="text-center svelte-1s2ez3w">My blue text</p>
203203
```
204204

205205
### Target any classname format
@@ -405,25 +405,25 @@ export default {
405405
background-color: #fff;
406406
transform: translateX(-50%) translateY(-50%);
407407
}
408-
section {
408+
section.svelte-1s2ez3w {
409409
flex: 0 1 auto;
410410
flex-direction: column;
411411
display: flex;
412412
height: 100%;
413413
}
414-
header {
414+
header.svelte-1s2ez3w {
415415
padding: 1rem;
416416
border-bottom: 1px solid #d9d9d9;
417417
}
418418
._1HPUBXtzNG {
419419
padding: 1rem;
420420
flex: 1 0 0;
421421
}
422-
footer {
422+
footer.svelte-1s2ez3w {
423423
padding: 1rem;
424424
border-top: 1px solid #d9d9d9;
425425
}
426-
button {
426+
button.svelte-1s2ez3w {
427427
background: #fff;
428428
border: 1px solid #ccc;
429429
border-radius: 5px;
@@ -447,11 +447,11 @@ export default {
447447
</div>
448448
```
449449

450-
**Note:** The svelte scoped classes are still being applied to the html elements with a style.
450+
**Note:** The svelte scoped class is still being applied to the html elements with a style.
451451

452452
## Why CSS Modules on Svelte
453453

454-
While the native CSS Scoped system should be largely enough to avoid class conflict, it could find its limit when working on a hybrid project. On a non full Svelte application where it is used to enhance pieces of the page; the thought on the class naming is no less different than the one on a regular html page to avoid conflict and unwilling inheritance. For example, on the modal component above, It would have been wiser to namespace some of the classes such as `.modal-body` and `.modal-cancel` to avoid inheriting styles from other `.body` and `.cancel`.
454+
While the native CSS Scoped system should be largely enough to avoid class conflict, it could find its limit when working on a hybrid project. On a non full Svelte application, the thought on the class naming would not be less different than what we would do on a regular html page. For example, on the modal component above, It would have been wiser to namespace some of the classes such as `.modal-body` and `.modal-cancel` in order to prevent inheriting styles from other `.body` and `.cancel` classes.
455455

456456
## License
457457

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": "1.2.0",
3+
"version": "1.2.1",
44
"description": "Svelte preprocessor to generate CSS Modules classname on Svelte components",
55
"keywords": [
66
"svelte",

0 commit comments

Comments
 (0)