File tree Expand file tree Collapse file tree 1 file changed +40
-2
lines changed
Expand file tree Collapse file tree 1 file changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -67,10 +67,9 @@ Pass an object of the following properties
6767| ` includePaths ` | ` {Array} ` | ` [] ` (Any) | An array of paths to be processed |
6868
6969
70-
7170## Usage on Svelte Component
7271
73- ** On the HTML markup** (not the CSS), Prefix any class name that require CSS Modules by * $style.* => ` $style.My_CLASSNAME `
72+ ** On the HTML markup** (not the CSS), Prefix any class name that require CSS Modules by * $style.* => ` $style.MY_CLASSNAME `
7473
7574``` html
7675<style >
@@ -209,6 +208,10 @@ A class can be naturally used on multiple elements.
209208Toggling a class on an element.
210209
211210``` html
211+ <script >
212+ let isActive = true ;
213+ </script >
214+
212215<style >
213216 .bold { font-weight : bold ; }
214217 </style >
@@ -217,6 +220,41 @@ Toggling a class on an element.
217220<p class =" {isActive ? '$style.bold' : ''}" >My blue text</p >
218221```
219222
223+ ### Shorthand
224+ To remove verbosity the shorthand ` $.MY_CLASSNAME ` can be used instead of the regular ` $style.MY_CLASSNAME ` .
225+
226+ * before*
227+
228+ ``` html
229+ <script >
230+ let isActive = true ;
231+ </script >
232+
233+ <style >
234+ .red { color : red ; }
235+ .blue { color : blue ; }
236+ .bold { font-weight : bold ; }
237+ </style >
238+
239+ <p
240+ class:$.bold ={isActive}
241+ class =" $.red" >My red text</p >
242+ <p class =" {isActive ? '$.bold' : ''} $.blue" >My blue text</p >
243+ ```
244+
245+ * After*
246+
247+ ``` html
248+ <style >
249+ .red-en-6pb { color : red ; }
250+ .blue-oVk-n1 { color : blue ; }
251+ .bold-2jIMhI { font-weight : bold ; }
252+ </style >
253+
254+ <p class =" red-en-6pb bold-2jIMhI" >My red text</p >
255+ <p class =" bold-2jIMhI blue-oVk-n1" >My blue text</p >
256+ ```
257+
220258## Example
221259
222260* Rollup Config*
You can’t perform that action at this time.
0 commit comments