broccoli-ember-auto-register
Automatically register Ember CLI addon files, making them usable from outside an Ember CLI app.
Installation
npm install --save-dev broccoli-ember-auto-register
Usage
var autoRegister = ;var registerTree = ;
The above will recursively walk sourceTree
, adding a container.register
call for each file it finds. So, for example, if there is a file named
components/x-foo.js
, the following will be written to the output file:
container;
The topmost directory is used as the type. So if we were to come across a file
named controllers/foo/edit.js
, the following would be generated:
container;
In the interest of keeping this plugin small and focused, it does not
attempt to filter the files. If you would like to exclude certain files, such
as .gitkeep
, you can do so with
broccoli-static-compiler like so:
var autoRegister = ;var pickFiles = ;var registerTree = ;
The above would only include .handlebars
, .hbs
, or .js
files under
app/
.
Options
moduleName
: What to call the module that exports the initialization function. By default this ismodulePrefix
+ '/register'.modulePrefix
: Prefix to be added to allrequire
statements. Usually this is the same as the name of your addon.outputFile
: Where to write the resulting file. By default this is 'register.js'.