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
* Register helper functions to be used in EJS templates
193
+
* Register helper functions to be used in
194
+
* EJS templates
94
195
*/
95
196
ejsHelper?: {
96
197
[keyinstring]: (tokenData: {
@@ -108,6 +209,40 @@ generate(
108
209
}
109
210
```
110
211
212
+
### Data and default helper functions available in EJS templates
213
+
214
+
#### Data
215
+
216
+
**tokens**
217
+
An array consisting of information from token objects and groups.
218
+
219
+
```typescript
220
+
{
221
+
props: string[];
222
+
value: TokenObj|TokenGroup;
223
+
meta: Record<`$${string}`, any>;
224
+
}
225
+
```
226
+
227
+
-**props**: Array of property names where token objects and groups are located
228
+
-**value**: Token objects and groups
229
+
-**meta**: Meta-information except $type, $value contained in token objects and groups
230
+
231
+
#### Default helper functions
232
+
233
+
Default helper functions available in EJS templates
234
+
235
+
**isTokenObj**
236
+
The value of the token data determines whether it is a token object or not.
237
+
238
+
example:
239
+
240
+
```ejs
241
+
<% tokens.forEach(function (token) { %>
242
+
<% if (!isTokenObj(token.value)) return %>
243
+
<%})%>
244
+
```
245
+
111
246
## Transform
112
247
113
248
Structural transformations are used to effectively use duplicate structures. When writing defined style attributes in JSON, duplication of values could be resolved with reference values, but not structurally. For example, here's an example of a case like this
0 commit comments