Disclaimer: this is my understanding, but I have not built an addon myself, so I might have some misconceptions.
Ember addons are basically normal packages with some additional structure that makes them easier to integrate in an ember application.
When using an Ember addon, you import things exactly like with any normal package. The only difference comes from objects that need to be registered with the resolver (services, adapers, helpers, etc): they will be automatically detected, added to your project and registered. This is why, after installing, say ember-notify
, you can just Ember.inject.service('notify')
in some component/controller and it will work.
The details are for the addon author to choose. Usually, addons will register common objects that benefit from dependency injection (template helpers and services, mostly - though some addons define new injection types and come with some packaged, for instance ember-validations
registers its validators
). For other functionalities, you import things normally (import thing from 'addon/thing';
).
Ember addons are installed using npm
(you find them in your project, under node_modules
). You can even install them with npm
yourself, just remember to add them to package.json
so they are included by ember build
.
In the build output, they should simply be packaged, altogether, into assets/vendor.js
.
I would say the rule of thumb should be: if it is ember-specific, make it an addon. Otherwise, stick to normal package. But really, an ember addon is basically a normal package that has a specific layout.