Skip to content

Commit 92d311f

Browse files
committed
feat: Add query selector for style rules
This commit introduces the ability to select style rules by query selector. This feature enhances the flexibility of style rule selection in Svelte. The README has been updated with examples and usage instructions.
1 parent 542df39 commit 92d311f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,44 @@ contents of b.css will be here
4444
</style>
4545
```
4646

47+
### Select Style Rules by Query Selector
48+
49+
You can select style rules by query selector.
50+
51+
For example, the following CSS and Svelte:
52+
53+
54+
```css
55+
/* a.css */
56+
57+
div { color: red; }
58+
59+
.message { color: blue; }
60+
```
61+
62+
```svelte
63+
<div> hello </div>
64+
<p class="message"> world </p>
65+
66+
<style>
67+
@import "./a.css?.message" scoped;
68+
69+
div { color: green; }
70+
</style>
71+
```
72+
73+
will get converted into:
74+
75+
```svelte
76+
<div> hello </div>
77+
<p class="message"> world </p>
78+
79+
<style>
80+
.message { color: blue; }
81+
82+
div { color: green; }
83+
</style>
84+
```
85+
4786
## License
4887
[MIT](./LICENSE)

0 commit comments

Comments
 (0)