slim.js
slim.js copied to clipboard
Idea for cleaner templates
In the templates this is required, perhaps a cleaner solution is to remove the this from your templates. This could been done for example by updating the expressionToJS function. See below:
return '`' + str.replaceAll('{{', '${this.').replaceAll('}}', '}') + '`'
Result
Before
<h1>Hello, {{this.who}}!</h1>
After
<h1>Hello, {{who}}!</h1>
Hi @jellehak, Can you please explain what is the pain point of using "this" in the template? The strict keyword this followed by a comma makes the detection very easy.