My company has many Ember apps and many elements are shared between them, like components, services, mixins, etc. To make our lives easier, we’ve built an addon that contains all the shared elements that can be installed in each app.
This works great except for the fact that all the elements get included whether they are used or not, and we are very concerned with file size.
We want to be able to specifiy which elements from the addon should be included when the app is built. Ideally the syntax would look something like this:
# ember-cli-build.js
var app = new EmberApp(defaults, {
mySharedAddon: {
include: [
'components/modal-dialog',
'components/date-picker',
'components/country-selector',
'services/authentication',
'services/current-user'
]
}
});
I think the solution is to modify the treeForAddon hook in the index.js file for the addon, but I don’t know enough about broccoli to know what I need to return. And there doesn’t seem to be any documentation on it.
Can anyone point me in the right direction?