Skip to content

Support asynchronous config for generated sidebar #1185

Closed
adamlaska/osmos-cosmos-sdk
#5
@Siilwyn

Description

@Siilwyn

Feature request

What problem does this feature solve?

Using a generated sidebar that is based on dynamic content. I'm fetching content before running vuepress build and as a workaround I now write the data needed for the sidebar in a JSON file and then synchronously read it. Instead it would be better to fetch the content and generate the sidebar in one go so no temporary file is needed.

What does the proposed API look like?

Two options, either the config export could return a Promise or the sidebar value can. E.g:

const fetchContent = () => Promise.resolve();
const generateSidebar = () => Promise.resolve({});

module.exports = {
  sidebar: fetchContent.then(generateSidebar),
}

How should this be implemented in your opinion?

Going with the sidebar example vuepress could check if the sidebar value is a Promise or not before building, which would also be backwards compatible.

Are you willing to work on this yourself?

Maybe, depending on the complexity of the change since I have no idea how far changing the code goes to make a part of the config resolution async.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions