Aurelia 2 Plugin Sample or Docs

Hi @gregoryagu. As you already know from Au1, there is not much special about the plugin, except the plugin’s configuration function, which is used during bootstrap, to setup global resources, and configuration options.

The same goes also for Au2. As an example, take a look at the i18n plugin in Au2:

The most interesting thing here is the register method. During "bootstrap"ing phase, an instance of IContainer is passed on to this. You can use that to register “global resources”, such as custom elements/attributes, value converters, binding behavior etc.

And then where this plugin is used, you do something like this:

container.register(I18nConfiguration);

If you allow customization from the client code, you can also do so. Clients may choose to setup the configuration by themselves completely ignoring your OOTB configurations. Or you may choose ease up the situation by exposing APIs to customize. In the example above, this is done in the customize method.

If you are not already familiar with the Au2 API, you may take a look here on how to migrate your CEs: https://docs.aurelia.io/getting-started/components#working-without-conventions.

And that’s all! Have fun with Au2 :slight_smile:

3 Likes