Component ecosystem. Plugin API?


#1

I’ve built a load of ember components as part of various apps, but this weekend I built my first free-standing ember component: Chosem.

The package I built requires 3 handlebars templates, is made up of 2 components, and has some structural CSS too, but there’s no way to pack all these up into a stand-alone package that a dev could just chuck into an app (moving a bunch of files into the right place and renaming them doesn’t cut it).

I know there’s been some discussions around a component ecosystem before, but I was wondering what everybody’s thoughts were on how we could solve this issue?

My understanding of the Ember source code is slim at best, but is there any way that Ember could have a plugin API?

Perhaps we could package up components in a standard way, then register them in the application declaration? The API could pick up the template dependancies by name, and perhaps the component could have a dependancy declaration of it’s own? Similar to how the flags work on canary builds.

I’m not sure on the exact details of how this might work (and I bet the core team has had discussions about it already), but I mainly wanted to get a discussion going to figure it out (or so people smarter than I could tell me how it couldn’t work).

Not only would it be super useful, it would take the ember community to the next level having a vibrant component ecosystem.

Thoughts?


#2

How about compiling your templates and inlining into the js file, then packaging via bower? If using requirejs, the user than just has to add the CSS file as an import in the main.css, and load the component as an AMD module where it’s used. This is what bootstrap-for-ember does, minus the AMD.


#3

Interesting…

Pre-compiling templates makes it much harder to override them though.

I really need to check out requirejs!