# Why mixes widget and handlebars?

**URL:** https://meta.discourse.org/t/why-mixes-widget-and-handlebars/104890
**Category:** Development
**Created:** [December 22, 2018, 10:42am UTC](https://meta.discourse.org/t/why-mixes-widget-and-handlebars/104890 "2018-12-22T10:42:17Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Chong\_An\_Chen](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@Chong\_An\_Chen](https://meta.discourse.org/u/Chong_An_Chen)
#### Post date: [December 22, 2018, 10:42am UTC](https://meta.discourse.org/t/why-mixes-widget-and-handlebars/104890/1 "2018-12-22T10:42:17Z")

</div>

Hi everyone, I’ve tried to customize our discourse for about a month.

Then I’d like to ask why mixes widget and handlebars together?  
I think that makes code more complicated and hard to maintain.

For an example, I want to move `Create Topic` button to header, then I just realized the button is created in hbs but header is in widget.

I really want to know the reason why you want to combine different things together.  
I know for performance issue widget is a good tool, but don’t you think that is harder to trace and revise?

And there is another question: Does anyone know how to trigger event in widget from ember controller?  
I’ve been stuck on the confusing architecture for a while..

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [December 22, 2018, 10:49am UTC](https://meta.discourse.org/t/why-mixes-widget-and-handlebars/104890/2 "2018-12-22T10:49:21Z")

</div>

> [@Chong\_An\_Chen](#):
>
> why mixes widget and handlebars together?

For performance reasons.

> [@Chong\_An\_Chen](#):
>
> I think that makes code more complicated and hard to maintain.

It does, but it’s a tradeoff we are ok to make for our hot paths.

---

<div class="post-metadata">

### Author: ![Chong\_An\_Chen](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@Chong\_An\_Chen](https://meta.discourse.org/u/Chong_An_Chen)
#### Post date: [December 22, 2018, 10:52am UTC](https://meta.discourse.org/t/why-mixes-widget-and-handlebars/104890/3 "2018-12-22T10:52:43Z")

</div>

thank you for replying quickly,

Do you know how to interact with widget from ember controller?

I’ve tried [A tour of how the Widget (Virtual DOM) code in Discourse works - #57 by eviltrout](https://meta.discourse.org/t/a-tour-of-how-the-widget-virtual-dom-code-in-discourse-works/40347/57), but it doesn’t work …

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 22, 2018, 12:49pm UTC](https://meta.discourse.org/t/why-mixes-widget-and-handlebars/104890/4 "2018-12-22T12:49:26Z")

</div>

Search for “theme #howto”

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [December 25, 2018, 12:41pm UTC](https://meta.discourse.org/t/why-mixes-widget-and-handlebars/104890/5 "2018-12-25T12:41:57Z")

</div>

My advice here would be to look at existing plugins like polls plugin etc.

There is a large list at: [GitHub - discourse/all-the-plugins · GitHub](https://github.com/discourse/all-the-plugins)
