Documentation for js_of_ocaml (#69)

This commit is contained in:
hhugo 2017-05-05 08:49:29 +01:00 committed by Jérémie Dimino
parent 031d57a70a
commit 5cf647e358
1 changed files with 15 additions and 0 deletions

View File

@ -1355,6 +1355,21 @@ description of an opam switch, as follows:
selected context for =merlin= will be =(context default)= if
present. Otherwise Jbuilder won't generate =.merlin= files
** Building JavaScript with js_of_ocaml
Jbuilder knows how to generate a JavaScript version of an executable (=<name>.bc.js=) using
the js_of_ocaml compiler (the =js_of_ocaml-compiler= opam package must be installed).
It supports two modes of compilation:
- Direct compilation of a bytecode program to JavaScript. This mode allows js_of_ocaml to perform
whole program deadcode elimination and whole program inlining.
- Separate compilation, where compilation units are compiled to JavaScript separately
and then linked together. This mode is useful during development as it builds more quickly.
The separate compilation mode will be selected when passing =--dev= to jbuilder. There is currently no other
way to control this behaviour.
See the [[Js_of_ocaml][section about js_of_ocaml]] for passing custom flags to the js_of_ocaml compiler
* Advanced topics
This section describes some details of Jbuilder for advanced users.