access eleventyConfig plugin property
Discussed in https://github.com/11ty/eleventy/discussions/3193
Originally posted by btrem February 7, 2024
I have several plugins in my site setup, which are listed in the eleventyConfig
in a plugins
array (shortened for ease of reading):
plugins: [
{
plugin: [AsyncFunction (anonymous)],
options: undefined,
pluginNamespace: ''
},
{
plugin: [Function (anonymous)],
options: undefined,
pluginNamespace: ''
}
]
One of my plugins has a pluginConfig
that I can access via eleventyConfig.plugins[1].options.foo
. Can I find this particular property directly? I.e., is there a way to access the plugin via it's name in the .eleventy.js addPlugin
directive? I tried JSON.stringify(eleventyConfig.plugins["myPlugin"])
and got undefined.