You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: tag names must be in the exact order as the default ones.
204
+
176
205
### Switch statement
177
206
178
207
Switch statements act like streamline conditionals. They are useful for when you want to compare a single variable against a series of constants.
@@ -201,6 +230,35 @@ locals: { foo: 'foo' }
201
230
202
231
Anything in the `expression` attribute is evaluated directly as an expressions.
203
232
233
+
#### `switchTags`
234
+
235
+
Type: `array`\
236
+
Default: `['switch', 'case', 'default']`
237
+
238
+
You can define custom tag names to use when creating a switch.
239
+
240
+
Example:
241
+
242
+
```js
243
+
switchTags: ['clause', 'when', 'fallback']
244
+
```
245
+
246
+
```html
247
+
<clauseexpression="foo">
248
+
<whenn="'bar'">
249
+
<p>Foo really is bar! Revolutionary!</p>
250
+
</when>
251
+
<whenn="'wow'">
252
+
<p>Foo is wow, oh man.</p>
253
+
</when>
254
+
<fallback>
255
+
<p>Foo is probably just foo in the end.</p>
256
+
</fallback>
257
+
</clause>
258
+
```
259
+
260
+
Note: tag names must be in the exact order as the default ones.
261
+
204
262
### Loops
205
263
206
264
You can use the `each` tag to build loops. It works with both arrays and objects. For example:
@@ -246,6 +304,27 @@ The value of the `loop` attribute is not a pure expressions evaluation, and it d
246
304
247
305
So you don't need to declare all the available variables (in this case, the index is skipped), and the expressions after `in` doesn't need to be a local variable, it can be any expressions.
248
306
307
+
#### `loopTags`
308
+
309
+
Type: `array`\
310
+
Default: `['each']`
311
+
312
+
You can define custom tag names to use for creating loops:
313
+
314
+
Example:
315
+
316
+
```js
317
+
loopTags: ['each', 'for']
318
+
```
319
+
320
+
You can now also use the `<for>` tag when writing a loop:
321
+
322
+
```html
323
+
<forloop="item in [1,2,3]">
324
+
<p>{{ item }}</p>
325
+
</for>
326
+
```
327
+
249
328
#### Loop meta
250
329
251
330
Inside a loop, you have access to a special `loop` object, which contains information about the loop currently being executed:
@@ -297,6 +376,27 @@ locals: {
297
376
</div>
298
377
```
299
378
379
+
#### `scopeTags`
380
+
381
+
Type: `array`\
382
+
Default: `['scope']`
383
+
384
+
You can define a custom tag name to use for creating scopes:
385
+
386
+
Example:
387
+
388
+
```js
389
+
scopeTags: ['context']
390
+
```
391
+
392
+
You can now also use the `<context>` tag when writing a scope:
393
+
394
+
```html
395
+
<contextwith="author">
396
+
<includesrc="components/profile.html"></include>
397
+
</context>
398
+
```
399
+
300
400
### Ignored tag
301
401
302
402
Anything inside this tag will not be parsed, allowing you to output delimiters and anything the plugin would normally parse, in their original form.
0 commit comments