-
-
Notifications
You must be signed in to change notification settings - Fork 518
Update template-tag-format.md to include info about the JS representation of the runtime compiler #2123
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
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for ember-guides ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for ember-guides ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Without specifying `/runtime`, there are additional restrictions required for the argument passed to `template()`: | ||
- it must be a string literal | ||
|
||
With the `/runtime`, the argument passed to `template()` can be an expression, for example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you say expression does that also include support for interpolation?
export default template`<div>${someValue}</div>`;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nay -- interpolation is a hazard because it can't be reactive as far as I know -- ideally we'd even add a lint that prevents that.
if reactivity is not needed, then I don't see a reason why this wouldn't work (I expect it to work -- just not be reactive on changes to someValue)
export default template(`<div>${someValue}</div>`);
/* someValue could be from anywhere */ | ||
export default default template(someValue); | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would help (me) to see example use cases for the different possibilities. Maybe when to precompile during a <script>
tag in the HTML <head>
versus dynamically from a <textarea>
. The difference between scope:
and ${stringInterpolation}
. Use of this in a build tool versus use of this in an HTML file. And how this might look used in a QUnit test or Vitest.
No description provided.