Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ahrefs/reshowcase

A tool to create demos for your ReasonReact components
https://github.com/ahrefs/reshowcase

melange ocaml reason reason-react reasonml

Last synced: 2 months ago
JSON representation

A tool to create demos for your ReasonReact components

Awesome Lists containing this project

README

        

# Reshowcase

⚠️ this is a fork of [original tool](https://github.com/bloodyowl/reshowcase) with the following updates:
- Migrated to use Melange and Dune, instead of ReScript and Ninja
- Use `reason-react` instead of `rescript-react`
- Use Reason syntax instead of ReScript syntax

> A tool to create demos for your Reason React components

![Screenshot](./example/example-2021.png)

```reason
open Reshowcase.Entry;

/* Create a demo*/
demo(({addDemo: _, addCategory}) => {
/* Add a category */
addCategory("Title", ({addDemo, addCategory: _}) => {
/* Add an example*/
addDemo("normal", ({string, _})
/* Register "handles" from your JSX directly*/
=>

{string("text", "hello")->React.string}

);
addDemo("font-size", ({string, int, _}) =>

Belt.Int.toString ++ {js|px|js}},
(),
)}>
{string("text", "hello")->React.string}


);
});
/* Add another category */
addCategory("Button", ({addDemo, addCategory: _}) =>
addDemo("normal", ({string, bool, _}) =>

{string("text", "hello")->React.string}

)
);
});

start();
```

## Install

Install [opam](https://opam.ocaml.org/) package manager.

Then:

```
opam pin add reshowcase.dev git+https://github.com/ahrefs/reshowcase.git#main
```

This will make the NodeJS script `reshowcase` available in your opam switch.

To make sure this script works, add the following dependencies to your application `package.json`:
```json
"devDependencies": {
"@craftamap/esbuild-plugin-html": "https://github.com/denis-ok/esbuild-plugin-html#79f512f447eb98efa6b6786875f617a095eaaf09"
}
```

## Usage

### To start / develop:

```console
$ reshowcase start --entry=path/to/Demo.js
```

### To build bundle:

```console
$ reshowcase build --entry=path/to/Demo.js --output=path/to/bundle
```

If you need custom esbuild options, create the `.reshowcase/config.js` and export the esbuild config. Plugins and modules will be merged.

If you need a custom template, pass `--template=./path/to/template.html`.