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
In my application, I'd like to run all JavaScript in strict mode, so I pass strict=true in the EJS options dict. This means that the with statement can't be used -- which I really miss; template variables are now locals.a instead of a. [1] Therefore, I wrote a small addition to EJS to wrap the replacement statements in a dynamically-generated function: I can run templates in strict mode and still refer to template variables as a. Would @mde be interested in a PR with this code? Here's the core of it, added to Template.function:
In my application, I'd like to run all JavaScript in strict mode, so I pass
strict=true
in the EJS options dict. This means that thewith
statement can't be used -- which I really miss; template variables are nowlocals.a
instead ofa
. [1] Therefore, I wrote a small addition to EJS to wrap the replacement statements in a dynamically-generated function: I can run templates in strict mode and still refer to template variables asa
. Would @mde be interested in a PR with this code? Here's the core of it, added to Template.function:[1] Yes, I could pass something like
localsName=v
to the EJS options dict then refer to variables asv.a
, but that's still a bit more awkward thana
.The text was updated successfully, but these errors were encountered: