Skip to content

Dynamic JS pages/components #292

@duailibe

Description

@duailibe

Hey guys! Loving this is open now, I hope to be able to contribute soon!

We've been using just a simple JS script on the Prettier docs playground and I've been pushing for a rewrite in React so we could do some cool stuff more easily:

  • creating the options sidebar automatically so a new PR that changes anything could be more easily integrated to the playground and people can play with it in the PR previews;
  • persisting the state in localStorage

To do that a build process would be necessary.. we currently just serve from /static, so I built a POC with the features above using Preact and https://github.com/developit/preact-in-es3/blob/master/index.js, but it's really cumbersome without JSX and would be nice to do it in React since that's what Docusaurus uses.

We could just build the playground independently (calling the transpiler/bundler and outputing directly to Docusaurus build dir), but would be nice to integrate this somehow so we could reuse the development server and have one script to build them all.

If this use case is something you guys would like to support, I'd love to help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions