Installation

First things first, you will need at least node version 18.8.0 and above installed.

After initialising your project, install coralite as a dev dependency:

bash
Code copied!
npm install --save-dev coralite

ECMAScript Modules

Coralite depends on ECMAScript Modules which is only available with the --experimental-vm-modules command flag enabled

There are two ways to add this command flag

Set the command flag after running node:

bash
Code copied!
node --experimental-vm-modules node_modules/coralite/bin/coralite

Or set flag via environment variable. If you are running windows, use cross-env to be able to set environment variables, otherwise use the following:

bash
Code copied!
NODE_OPTIONS="--experimental-vm-modules" coralite

Build options

Build script

To prepare the development environment, we'll add the build command to the "script" property in our package.json file.

Here is an example of what your package.json file should look like

JSON
Code copied!
{
  "name": "my-coralite-site",
  "scripts": {
    "build": "NODE_OPTIONS="--experimental-vm-modules" coralite -t src/templates -p src/pages -o dist"
  },
  "devDependencies": {
    "coralite": "^0.6.2"
  }
}

Next, follow the getting started guide to discover how build your first web page with coralite!