Closed brsanthu closed 2 years ago
The 'it' is a nice feature but shouldn't be required as it is one of the reasons keeping me upgrading to version 8. I also feel that 'it' property name should be definable by the developer.
After reviewing the code looks like you can pass varName option to rename the variable to something else besides 'it'.
https://github.com/squirrellyjs/squirrelly/blob/572a643/src/config.ts#L50
From Someone else:
If you actually want to be able to write something like: {{ reference }}
rather than {{ it.reference }}
, simply render as such:
const myTemplate = 'My favorite template engine is {{reference}}.'
const data = {
reference: 'Squirrelly'
}
const result = Sqrl.render(myTemplate, data, { useWith: true })
Looks like that requirement of prefixing with 'it' is here to stay so will close this issue.
Thank you for the library.
Couple of questions.