Plugins

April 17, 2019 ยท View on GitHub

The configuration can be extended using plugins.

Plugins are configured with the plugins configuration property, which is an array of objects with properties:

  • plugin {function} or {string} (system plugins names)
  • opts {object}: plugin-specific options
  • enabled {boolean}: defaults to true
plugins:
  - plugin: author
    opts:
      currentuser:
        $ref: get_user.js
      collection: users
  - plugin: timestamp
    enabled: false
  - plugin:
      $ref: custom_plugin.js

System plugins

The following system plugins are available:

Custom plugins

A plugin is simply a function that takes as input:

  • config {object}
  • opts {object}: plugin options

And return the configuration properties to merge in.

The function can be asynchronous by returning a promise.

The input arguments are read-only.