Skip to content

Fix component template lookup with pods.#53

Merged
stefanpenner merged 1 commit intoember-cli:masterfrom
rwjblue:make-component-template-lookup-suck-less
Jun 15, 2014
Merged

Fix component template lookup with pods.#53
stefanpenner merged 1 commit intoember-cli:masterfrom
rwjblue:make-component-template-lookup-suck-less

Conversation

@rwjblue
Copy link
Member

@rwjblue rwjblue commented Jun 13, 2014

Previously to use the pods structure for a component, you would have to define your template in app-prefix/components/my-pod-name/template, which is not what is expected naturally.

Now a components template is looked up in app-prefix/my-pod-name/template.

Fixes #30.


This is backwards incompatible for folks that were previously relying on the silly module name. In theory I can make it work either way, but I doubt that is a big issue (who would choose to use that naming?).

Previously to use the pods structure for a component, you would have to
define your template in `app-prefix/components/my-pod-name/template`, which
is not what is expected naturally.

This change fixes that so that it looks up a components template in
`app-prefix/my-pod-name/template`.
@stefanpenner
Copy link
Contributor

If your pod has a view and a component this is vague. Maybe component.hbs and template.hbs?

@rwjblue
Copy link
Member Author

rwjblue commented Jun 13, 2014

@stefanpenner - Unfortunately, component.hbs and component.js would both end up (module name wise) as my-component/component.

Generally speaking, a component is a unique named thing in the system not a standard application domain concern (like a route/controller/view/template combo). I do not think that it is a normal (or a good idea) to share route/controller/view names with a component.

@wiiiimm
Copy link

wiiiimm commented Jun 13, 2014

👍

@wiiiimm
Copy link

wiiiimm commented Jun 13, 2014

i guess if you really want to have a view and a component together using the same name, it might be better to name the component differently, maybe:

view
app/user/template.hbs
app/user/view.js
...

component
app/component-user/template.hbs
app/component-user/component.js
...

@rwjblue
Copy link
Member Author

rwjblue commented Jun 13, 2014

Alternatively, I could make the components template be at app-prefix/my-pod-name/component/template. Just move the components/ to the end. Still feels somewhat odd to have them share names, but this would certainly fix @stefanpenner's concern.

@stefanpenner
Copy link
Contributor

we can do magic re: component.hbs unsure if we should

@stefanpenner
Copy link
Contributor

so its basically view or component, but not both.. I think i can live with that. (i assume i will regret saying this)

[Edit: thanks @williamli ]

@wiiiimm
Copy link

wiiiimm commented Jun 13, 2014

@stefanpenner u meant view or component, but not both right?

@rwjblue
Copy link
Member Author

rwjblue commented Jun 15, 2014

We can go with this as is, or tweak it a bit more so that the template is looked up in components/ subdirectory of the pod name.

@stefanpenner - Thoughts?

stefanpenner added a commit that referenced this pull request Jun 15, 2014
…uck-less

Fix component template lookup with pods.
@stefanpenner stefanpenner merged commit cf132d0 into ember-cli:master Jun 15, 2014
@haywoood
Copy link

This broke my application, and I'm not sure what the change does. My components are currently the only thing in my application utilizing the pod structure, so I want to put all my components in the app/components directory. How do I modify my structure to work with this change?

@wiiiimm
Copy link

wiiiimm commented Jun 18, 2014

@lsdafjklsd i don't think these code have been rolled out yet. but the changes were documented here: #30

kratiahuja pushed a commit to kratiahuja/ember-resolver that referenced this pull request Aug 5, 2016
Implement a noConflict mode for the loader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Components with templates in pod structure

4 participants