@agrarium/plugin-list

Agrarium plugin for collecting anything to the component context.

Usage no npm install needed!

<script type="module">
  import agrariumPluginList from 'https://cdn.skypack.dev/@agrarium/plugin-list';
</script>

README

Agrarium List Plugin

Agrarium plugin for collecting anything to the component context.

Usage

npm i agrarium

Or use it standalone:

npm i @agrarium/plugin-list

In your .agrarium.js file:

const { PluginList } = require('agrarium');

module.exports = {
    src: ['./src/components'],
    plugins: [
        new PluginList({
            collect: (component, context) => ({
                components: context.components ?
                    [].concat(context.components, component.key) :
                    [component.key]
            })
        })
    ]
};

Example of result data

console.log(chunk.context)

{
    components: ['button', 'input', ...]
}

License MIT