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
This plugin provides a syntax for including local variables and expressionsressions in your templates, and also extends custom tags to act as helpers for conditionals and looping.
34
+
This plugin provides a syntax for including local variables and expressions in your templates, and also extends custom tags to act as helpers for conditionals and looping.
35
35
36
36
You have full control over the delimiters used for injecting locals, as well as the tag names for the conditional and loop helpers, if you need them. All options that can be passed to the `expressions` plugin are shown below:
37
37
@@ -41,7 +41,7 @@ You have full control over the delimiters used for injecting locals, as well as
41
41
|:----:|:-----:|:----------|
42
42
|**delimiters**|`['{{', '}}']`| Array containing beginning and ending delimiters for escaped locals |
43
43
|**unescapeDelimiters**|`['{{{', '}}}']`| Array containing beginning and ending delimiters for unescaped locals |
44
-
|**locals**|`{}`| Object containing any local variables you want to be available inside your expressionsressions|
44
+
|**locals**|`{}`| Object containing any local variables you want to be available inside your expressions|
45
45
|**conditionalTags**|`['if', 'elseif', 'else']`| Array containing names for tags used for `if/else if/else` statements |
46
46
|**loopTags**|`['each']`| Array containing names for `for` loops |
47
47
|**scopeTags**|`['scope']`| Array containing names for scopes |
@@ -96,13 +96,13 @@ In this case, your code would render as html:
96
96
97
97
### Expressions
98
98
99
-
You are not limited to just directly rendering local variables either, you can include any type of javascript expressionsression and it will be evaluated, with the result rendered. For example:
99
+
You are not limited to just directly rendering local variables either, you can include any type of javascript expressions and it will be evaluated, with the result rendered. For example:
With this in mind, it is strongly recommended to limit the number and complexity of expressionsressions that are run directly in your template. You can always move the logic back to your config file and provide a function to the locals object for a smoother and easier result. For example:
105
+
With this in mind, it is strongly recommended to limit the number and complexity of expressions that are run directly in your template. You can always move the logic back to your config file and provide a function to the locals object for a smoother and easier result. For example:
106
106
107
107
```js
108
108
locals: {
@@ -140,7 +140,7 @@ locals: { foo: 'foo' }
140
140
<p>Foo is probably just foo in the end.</p>
141
141
```
142
142
143
-
Anything in the `condition` attribute is evaluated directly as an expressionsression.
143
+
Anything in the `condition` attribute is evaluated directly as an expressions.
144
144
145
145
It should be noted that this is slightly cleaner-looking if you are using the [SugarML parser](https://github.com/posthtml/sugarml). But then again so is every other part of html.
146
146
@@ -189,7 +189,7 @@ locals: {
189
189
<p>foo: bar</p>
190
190
```
191
191
192
-
The value of the `loop` attribute is not a pure expressionsression evaluation, and it does have a tiny and simple custom parser. Essentially, it starts with one or more variable declarations, comma-separated, followed by the word `in`, followed by an expressionsression.
192
+
The value of the `loop` attribute is not a pure expressions evaluation, and it does have a tiny and simple custom parser. Essentially, it starts with one or more variable declarations, comma-separated, followed by the word `in`, followed by an expressions.
193
193
194
194
195
195
```html
@@ -198,7 +198,7 @@ The value of the `loop` attribute is not a pure expressionsression evaluation, a
198
198
</each>
199
199
```
200
200
201
-
So you don't need to declare all the available variables (in this case, the index is skipped), and the expressionsression after `in` doesn't need to be a local variable, it can be any expressionsression.
201
+
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.
0 commit comments