-
Notifications
You must be signed in to change notification settings - Fork 305
Make dotted names work in the Meteor template compiler #46
Comments
This will almost certainly mean making it an error to assign helpers in the super old pre-1.0 way. But we've been warning about that for over a year now so it's probably OK. |
@mitar I see that Blaze Components already have this feature: https://github.com/peerlibrary/meteor-blaze-components#namespaces Do you see any problems with adding this to core templates? |
Hmm, if I remember correctly, there were quite some edge cases to cover. First, probably it would be easiest to simply make templates be accessible under Then the question becomes can Then some things should be fixed:
And So the hard problem is So yea, it can be done, but I think some more work has to be done. Question is, should we all just move to Blaze Components instead. ;-) |
I don't feel like #4230 or #4232 are blockers for specifically this issue. They are all bugs related to dots and templates, but I'm not talking about rendering templates returned from helpers here. I'm planning to just add a thing that says "check a.b.c in its entirety against the space of available templates." |
Imho its an issue with Meteor templates namespacing / scoping in general - Theres no way for two packages to export ui components. (should be treated as symbols/js objects - this is something handled better in the react pattern, where you have more control + can extend components etc. more easily) |
This is why I am proposing that templates are exported as whole names, so |
I guess we are not going to do this in the end. |
Why not? |
I could maybe take it if someone has a nice PR (I can't remember if there is or not) but it seems simpler to just make an exception for templates and namespace them with underscores rather than writing a bunch of code just to make the separators dots. Plus, underscores have the nice advantage over dots in JS that they don't need to be put in quotes and brackets when accessing a template. |
One more reason to use Blaze Components then. ;-) |
Sure! |
We could just have "Template" be scoped to package or app. import { Template as accountTemplate } from 'mdg:accounts-ui'
Template.main.helpers({
logout: accountsTemplates.logout
}); or import { myTemplate } from './my-template.html'
myTemplate.helpers({
foo: () => 'bar'
});
export { myTemplate } |
Yes but all of that requires additional code to be written - namespacing via underscores doesn't. |
So, we get again back to the question of how much time does MDG want to invest into improving the platform, or are we just stuck with what we have. |
Like, the point of Meteor Development Group is to develop, no? |
I mean if you want to get technical then the word "develop" doesn't just mean writing code. We're investing literally all of our time improving the platform, we just don't currently think that spending a week making templates work via import/export is the highest priority right now. |
And what is the priority? Still just Galax? Maybe then guide should recommend Blaze Components? If you do not have time to invest to make bare Blaze improved, which is OK, then start promoting projects which do that? I thought the agreement was that because we can modify Blaze according to some ideas from Blaze Components, we can then cover common cases. But maybe Blaze Components is the way what should be promoted in the guide:
|
Needed for #9.
Should be accessible via:
It should also be OK to simultaneously have a template called
a.b
anda.b.c
, so that you can do something like:The text was updated successfully, but these errors were encountered: