Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offer a way to pass configuration structures to plugins #1701

Closed
atrauzzi opened this issue Aug 3, 2017 · 2 comments
Closed

Offer a way to pass configuration structures to plugins #1701

atrauzzi opened this issue Aug 3, 2017 · 2 comments

Comments

@atrauzzi
Copy link
Contributor

atrauzzi commented Aug 3, 2017

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:

  • Root subclass is found at: src/Protoculture.ts
  • [the configuration feature desired] imports and holds a reference to the root subclass constructor
  • My gatsby-browser.tsx somehow receives and inspects this config
  • My gatsby-browser.tsx instantiates the root application in onClientEntry, which kicks off into my DI ecosystem allowing me to resolve out things like redux and other goodies

( 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 #858 . FWIW, protoculture is inspired by the laravel web framework and countless other DI systems. )

@KyleAMathews
Copy link
Contributor

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

@atrauzzi
Copy link
Contributor Author

atrauzzi commented Aug 5, 2017

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

#hiimnew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants