dimanche 7 mai 2017

Override ember component template with template from addon (in-repo)

I want to create an in-repo addon to make certain modifications (styles, templates, etc.) to an existing ember app in an encapsulated way, but I'm having troubles overriding the templates.

Right now, I'm trying to override an existing component template with the template from a component with the same name in the in-repo addon. My code looks something like this:

// my-app/app/templates/components/foo.hbs
<h1>Some headline<h1>

// my-app/app/lib/my-addon/app/templates/components/foo.hbs
<h1>A different headline<h1> // -> this never shows up

I've tried a lot of switching around the template structure (like putting it in /addons or /app and linking to the template in different ways, but without success. My problem is that ember never uses the template from the addon.

If the component within the addon has a different name, like foobar.hbs, I can call it without a problem.

I'm currently looking through the source code and docs, trying to make sense of this. Is this even accomplishable the way I imagine it?

Thanks a lot!




Aucun commentaire:

Enregistrer un commentaire