feat(v2): implement client modules API (#1554)

* feat(v2): load client modules

* docs(v2): update plugins API

* misc(v2): change to import
This commit is contained in:
Yangshun Tay 2019-06-03 23:33:00 -07:00 committed by GitHub
parent 90138d52c2
commit c06ccc0a07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 174 additions and 3 deletions

View file

@ -66,8 +66,12 @@ module.exports = function(context, opts) {
const options = {...DEFAULT_OPTIONS, ...options};
return {
// Namespace used for directories to cache the intermediate data for each plugin.
name: 'docusaurus-cool-plugin',
// A compulsory field used as the namespace for directories to cache
// the intermediate data for each plugin.
// If you're writing your own local plugin, you will want it to
// be unique in order not to potentially conflict with imported plugins.
// A good way will be to add your own project name within.
name: 'docusaurus-my-project-cool-plugin',
async loadContent() {
// The loadContent hook is executed after siteConfig and env has been loaded
@ -107,6 +111,17 @@ module.exports = function(context, opts) {
getPathsToWatch() {
// Path to watch
},
getThemePath() {
// Returns the path to the directory where the theme components can
// be found.
},
getClientModules() {
// Return an array of paths to the modules that are to be imported
// in the client bundle. These modules are imported globally before
// React even renders the initial UI.
},
};
};
```