gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

Offer a way to pass configuration structures to plugins #1701

Closed atrauzzi closed 7 years ago

atrauzzi commented 7 years ago

One particular plugin I have in mind is to integrate with my application framework ( https://github.com/atrauzzi/protoculture ).

To do this, I need to instantiate a subclass of my "root" application class which would live inside the gatsby project itself. If I made a gatsby plugin as an npm package, I'd need some way to inform the plugin where it can find that root subclass from the current gatsby project. Something like:

( Cheap plug: @KyleAMathews - feel free to look at protoculture for inspiration as it's all about application structure. It might offer you some ideas for things like https://github.com/gatsbyjs/gatsby/issues/858 . FWIW, protoculture is inspired by the laravel web framework and countless other DI systems. )

KyleAMathews commented 7 years ago

Perhaps I'm missing something? Plugins can take options.

atrauzzi commented 7 years ago

Haha, oh! Where do you set the options? I think I'm the one not seeing it at this point, lol.

hiimnew