facebook / facebook/docusaurus

Extend existing content plugins (CMS integration, middleware, doc gen...)

Aperta
#4,138 31 commenti 7 reazioni 0 assegnatari Vedi su GitHub
proposal
Lingua principale
TypeScript
Stelle
66.2k
Fork
10k
Merge medio
1g 3h
PR unite (30g)
52

Descrizione

## 💥 Proposal

I've written a couple of blog posts (which I will shortly publish) on how to use Docusaurus as a headless CMS, with Wordpress's Gutenberg.

I've also written a sample plugin, `wordpress-to-docusaurus-plugin` which uses GraphQL to pull Blog posts from Wordpress, which I then use to build Docusaurus posts with.

All looks good but one problem remains. Plugins currently load in parallel, so new blog posts are not seen until I reload. I need my plugin's `loadContent` to run before the blog plugin runs, so it sees the new posts, I've created.

I would like to add an optional `loadingPriority` to plugin options, which defines the order they are loaded.

This will enable us to still load plugins in parallel or without any priority defined but for certain use-cases, we can prioritise the order of loading.

I've found, I only need to prioritise, `loadContent`, so we could have a single numeric `loadingPriority` option which is available to any plugin.

```
[
require.resolve('wordpress-to-docusaurus-plugin'),
{
// ... my other options
loadingPriority: 1 // optional
},
],
```

It's small change that is required to the existing code to make this possible.
Is this a PR you would be interested in reviewing or do you have an alternative preference ?

### Have you read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/master/CONTRIBUTING.md#reporting-new-issues)?

Yes

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.