# Combining Component Logic and Template together in single file?

**URL:** <https://discuss.emberjs.com/t/combining-component-logic-and-template-together-in-single-file/2879>\
**Category:** Proposals\
**Created:** [October 4, 2013, 9:18pm UTC](https://discuss.emberjs.com/t/combining-component-logic-and-template-together-in-single-file/2879 "2013-10-04T21:18:01Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![aexmachina](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/aexmachina/32/15125_2.png) [@aexmachina](https://discuss.emberjs.com/u/aexmachina)\
**Post date:** [October 29, 2013, 9:11am UTC](https://discuss.emberjs.com/t/combining-component-logic-and-template-together-in-single-file/2879/9 "2013-10-29T09:11:05Z")

</div>

It looks like this discussion has been idle for a while but I think that this is an important area that needs improvement in Ember. I want to get to a world where I can drop in Ember components using bower and have them ‘just work’ like a lot of npm modules do. The problem with this is that it requires me to copy/link files into the appropriate location for the Ember resolver to find the templates.

I can see two simple solutions to this problem:

1. Allow Components to inform the resolver that its templates can be found at a given path
2. Or, if a component’s templates isn’t be found in `components/` then it is looked for in the same directory as the component itself

Option 2, obviously presents some challenges because the resolver would need to track the path (URI or module path) that each component was loaded from. However it also provides a nice extension point for modifying the presentation of components: if you want to make changes to the way a component is presented then you can simply copy its template into `components/` and make your changes.

We could also provide this using Option 1, because users could use the same API to tell the resolver to get the template from some path that they specify.

Funnily enough, I’m only raising this because I’m about to release a component (ember-spin.js) which doesn’t require a template at all, but I need to instruct users to create an empty `components/spin.js` Handlebars template or the component won’t work.

Anybody got thoughts on how to proceed with this?

---

_[View the full topic](https://discuss.emberjs.com/t/combining-component-logic-and-template-together-in-single-file/2879)._
