package html_of_jsx
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Render HTML with JSX
Install
dune-project
Dependency
Authors
Maintainers
Sources
html_of_jsx-0.0.9.tbz
sha256=edc7d6d604820ef20d76611eaf7fdc29c691dd9fb48ed9930900f7f331dfea02
sha512=35eead27322cc1d3b34e32ed964449ff83a75f74f01c1127d54504145192b9c7726820f4825f5c793bde0887df202e4769946782d4f42c40b3a5a609daa4aada
doc/getting-started.html
Getting started
Installation
From the opam repository
opam install html_of_jsx -yor from source (via opam pin)
Pin a specific development commit from GitHub:
opam pin add html_of_jsx.dev "https://github.com/davesnx/html_of_jsx.git#01c813023e432cd4088b86ee21d5c3af2fc63bdc" -yor with the dune package manager
Add html_of_jsx to the depends field in your dune-project:
(package
(name my_app)
(depends
(ocaml (>= 4.14))
(html_of_jsx (>= 0.1.0))))Then lock and install:
dune pkg lock
dune buildDune setup
Every executable or library that uses JSX needs two things: the runtime library and the ppx preprocessor.
An executable:
(executable
(name server)
(libraries html_of_jsx)
(preprocess (pps html_of_jsx.ppx)))A library:
(library
(name components)
(libraries html_of_jsx)
(preprocess (pps html_of_jsx.ppx)))See ppx settings for all available flags.
Syntax setup
html_of_jsx works with two JSX-capable syntaxes: Reason and mlx.
Reason
opam install reason -yReason files use the .re extension and work out of the box with dune.
mlx
mlx lets you write JSX directly inside OCaml files.
opam install mlx ocamlformat-mlx ocamlmerlin-mlx -yAdd the dialect to your dune-project:
(dialect
(name mlx)
(implementation
(extension mlx)
(merlin_reader mlx)
(format
(run ocamlformat-mlx %{input-file}))
(preprocess
(run mlx-pp %{input-file}))))Then name your files with the .mlx extension instead of .ml.
Editor support
The vscode-ocaml-platform extension supports both Reason and mlx out of the box, including syntax highlighting, type information, and go-to-definition.
Next
- Core API for basic usage
- Settings for ppx flags
- Dream integration to integrate with Dream
- How the ppx works for a closer look at the JSX transformation.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page