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
Templates shouldn't be allowed to have hyphens in names and the fact that older rendering engine Spark supported it just means Spark wasn't designed to support features like JS-expressions inside your templates.
Consider the following template call:
{{> foo x-5 }}
where the x-5 expression part is some kind of argument to a template/component or a helper. If instead of foo the template name was foo-bar, it would be confusing for the spacebars parser to determine if it is a name of the template or a subtraction expression and that's why it shouldn't be allowed. You can imagine foo to be a template that dynamically decides what template you want to render based on a js expression.
Moreover, in the future one might want to do (syntax TBD):
{{> foo(x-5)}}
which might call the foo helper with the result of x-5 as an argument to dynamically choose the template to include
Summary :
Should templates to be allowed to have hyphens in names ?
<template name="super-duper"> compiles but {{> super-duper }} won't load it. Probably the template should fail to compile...
{{> super-duper }} fails to compile whereas {{> super-1}} compiles but tries to load super.
The text was updated successfully, but these errors were encountered:
(From meteor/meteor#1602)
Description:
In the new rendering engine:
If template has a dash in name, it will fail to be compiled. Example:
See the reproduction: https://github.com/Slava/meteor-dashed-template-bug-repruduction
Discourse:
Templates shouldn't be allowed to have hyphens in names and the fact that older rendering engine Spark supported it just means Spark wasn't designed to support features like JS-expressions inside your templates.
Consider the following template call:
where the x-5 expression part is some kind of argument to a template/component or a helper. If instead of foo the template name was foo-bar, it would be confusing for the spacebars parser to determine if it is a name of the template or a subtraction expression and that's why it shouldn't be allowed. You can imagine foo to be a template that dynamically decides what template you want to render based on a js expression.
Moreover, in the future one might want to do (syntax TBD):
which might call the foo helper with the result of x-5 as an argument to dynamically choose the template to include
Summary :
<template name="super-duper">
compiles but{{> super-duper }}
won't load it. Probably the template should fail to compile...{{> super-duper }}
fails to compile whereas{{> super-1}}
compiles but tries to loadsuper
.The text was updated successfully, but these errors were encountered: