-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Experimental] Add super rudimentary support for plugins #1299
Conversation
* Add a plugins section to the config that expects an array of sections * Add plugins directory * Incorporate plugins into the initialization of sections.js
Thanks for starting this :) A parallel improvement we discussed is also absorbing some of the description of a section — has sidebar, under which top level section it lives (my-sites, reader, me...), the ability to add a sidebar item declaratively, etc — in the |
\o/ |
As I said in previous conversations on the matter, I kind of think it would be a good idea to have some standard method to allow plugins to monkey-patch our own 'internal' components. Like, for example, having a Example: package.json
rating-ascii.js:
The package.json would tell our build process that it should take the plugin Also, it will probably encourage us to write much more modular components (no more 50 lines render methods, since we would want to make them easy to extend and rewrite) It may sound risky... but it isn't much different of what current php plugins are doing with php admin ... |
Monkey patching definitely has had a role in the history of JavaScript, but I think it might be interesting to take a page from React and try to come up with guard rails that help developers fall into the pit of success. In terms of being able to make it possible to replace a component with another, I think some sort of |
I definitely agree with @johnHackworth that the configuration for the plugin should be part of the plugin and not the configuration file since that will be required in order to make it possible to distribute the plugin. The first step actually may actually be thinking about how Calypso is distributed for general use, which probably means publishing to |
How about distributing plugins via As it comes to monkey-patching, I think we should adopt something similar to |
Closing for now since no activity in 6 months — feel free to re-open and continue discussing when the time allows or interest picks back up. |
At WordCamp US, there has been some discussion around the potential for Calypso to support plugins. This PR is just a quick example that illustrates how the code chunking and dynamic route definition could be utilized to make it possible for plugins to add routes.
The basic idea is that plugins are a directory in a top-level
plugins
directory. In this form, the plugin is a section, which while neat isn't ideal long-term because there will need to be a need for both the ability to define new sections and for code to be loaded elsewhere so that the route can be linked to from elsewhere via some way of hooking in.