mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-22 19:17:46 +02:00
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:
parent
90138d52c2
commit
c06ccc0a07
9 changed files with 174 additions and 3 deletions
|
@ -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.
|
||||
},
|
||||
};
|
||||
};
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue