-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs/syntax/helpers #22
Comments
It's unclear what's the use here for blocks, also I'm missing the code that relates to this example. |
Can a self-closing helper return an array of values? for example: Can we nest the result of an helper with another helper? |
@ilanl you can't nest the result of a helper with another helper. In cases requiring complex logic like that, it's best to move all the logic inside one helper. A self-closing helper can return an array of values, but it will be automatically turned into a string by Squirrelly when it's interpolated into the template. |
@ilanl blocks are mainly useful when you want to define two "sub-templates" that can be passed into one helper function. For example, the
"Display this!" is inside the default block, passed into the The |
Is there a way to extend the "each" helper so it can call a callback function on each iteration? The idea is to update a progress bar along the template execution (useful when processing big JSON data) so user will know how long to wait until completion. Thanks |
@tafandi you can look at https://github.com/squirrellyjs/squirrelly/blob/d460cc1bf705c9e73991aa1317680993239dcde4/src/containers.ts#L46 for the current |
This page is completely unclear to me.
|
As @theogravity said, I'm a bit confused to. Is there an example on this page that shows the code that defines a helper? |
Helpers | SquirrellyJS
Helpers are an easy way to include logic within a template. Conditionals, looping, and partials are all implemented using helpers.
https://squirrelly.js.org/docs/syntax/helpers
The text was updated successfully, but these errors were encountered: