build icon indicating copy to clipboard operation
build copied to clipboard

Plugin presets

Open ehmicky opened this issue 6 years ago • 1 comments

This is a follow-up on #227 and #18.

We want to allow bundles/presets of plugins.

The last solution we had was to allow plugins to return an array of objects instead of a single object. I started implementing it and realized this solution had many issues:

  1. There's no way for plugin presets to set the configuration of each individual plugin. Calling the plugin top-level function with a pluginConfig object does not work since plugin hooks also receive a pluginConfig object as argument.
  2. Individual plugins would re-use the id and type from the plugin preset, which makes them harder to debug in logs.
  3. There's no way for users to set the enabled, timeout, etc. options to individual plugins
  4. There's no way for users to set plugin configuration options if two plugins uses the same configuration property name.

Now there's a solution! Plugin presets can simply be packaged as shareable configuration. Example:

@netlify/preset-webperf would export:

plugins:
  - type: '@netlify/plugin-lighthouse'
    config:
      currentVersion: '0.0.3'
      compareWithVersion: '0.0.1'
  - type: '@netlify/plugin-subfont'
  - type: '@netlify/plugin-svgoptimizer'

User would use the preset like this:

extends: ['@netlify/preset-webperf']

User can override any preset's plugin configuration:

extends: ['@netlify/preset-webperf']
plugins:
  - type: '@netlify/plugin-subfont'
    config:
      foo: bar

ehmicky avatar Oct 24 '19 12:10 ehmicky

Done by #373.

ehmicky avatar Oct 24 '19 13:10 ehmicky

This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 14 days if no further activity occurs. Thanks!

github-actions[bot] avatar Apr 11 '23 14:04 github-actions[bot]

This issue was closed because it had no activity for over 1 year.

github-actions[bot] avatar Apr 26 '23 14:04 github-actions[bot]