To install BuckleScript & Reason globally:
yarn global add bs-platform
npm install -g bs-platform for npm).
The global installation comes with a simple project generator. Try:
bsb -init my-new-project -theme basic-reason
To compile & run the project you just created:
cd my-new-project yarn build # or npm run build, for npm node src/Demo.bs.js
During development, instead of running
npm run build each time to compile, run
npm run start to start a watcher that recompiles automatically after file changes.
By default, the
basic-reason theme configures BuckleScript to output the generated JS files alongside the Reason files they were produced from. There's a reason why this is helpful. If you prefer to keep the generated files somewhere else, edit
bsconfig.json to set
false; the JS files will then be output to the
lib/js directory instead.
You can install the toolchain locally to an existing project, through the familiar command:
yarn add --dev bs-platform
npm install --save-dev bs-platform for npm).
The rest is the same as above.