Skip to content
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

Templates with a dash('-') in name compile but can't be used #91

Closed
distalx opened this issue Sep 9, 2016 · 2 comments
Closed

Templates with a dash('-') in name compile but can't be used #91

distalx opened this issue Sep 9, 2016 · 2 comments

Comments

@distalx
Copy link
Contributor

distalx commented Sep 9, 2016

(From meteor/meteor#1602)

Description:
In the new rendering engine:
If template has a dash in name, it will fail to be compiled. Example:

<template name="super-duper">
  Here I am!
</template>

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:

{{> 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.
@mitar
Copy link
Collaborator

mitar commented Jan 6, 2017

I would say the same as in #38, we should probably provide {{> "super-duper"}} syntax to reference non-simple template names

@filipenevola
Copy link
Collaborator

I'm closing this issue because it's too old.

If you think this issue is still relevant please open a new one.

Why? We need to pay attention to all the open items so we should keep opened only items where people are involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Blaze maintenance
Potential bugs
Development

No branches or pull requests

3 participants