Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.87 KB

README.md

File metadata and controls

49 lines (32 loc) · 1.87 KB

melange-opam-template (ReasonReact, Vite, Tailwind)

Forked from this original template and changed to use Vite and Tailwind. This template uses only Reason syntax and not OCaml.

A simple project template using Melange with opam.

If you are looking for a template with esy, check melange-esy-template.

Quick Start

make init

# In separate terminals:
make watch
make dev

React

React support is provided by reason-react. The entry point of the sample React app is src/Index.re.

Fast refresh

To enable React fast refresh, write .rei interface files for each component.

Commands

You can see all available commands by running make help or just make. Here are a few of the most useful ones:

  • make init: set up opam local switch and download OCaml, Melange and JavaScript dependencies
  • make install: install OCaml, Melange and JavaScript dependencies
  • make watch: watch for the filesystem and have Melange rebuild on every change
  • make dev: serve the JS application with a local HTTP server
  • make bundle: create production build of app
  • make preview: serve the production build of the JS application with a local HTTP server

JavaScript output

Since Melange just compiles source files into JavaScript files, it can be used for projects on any JavaScript platform - not just the browser.

This template includes just one melange.emit stanza and not the two stanzas from the original template. Please refer to the original template to see how to output JS code for the browser and node using two separate stanzas.

_build/default/src/output/src/Index.js in index.html is used as the entry point for Vite.