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 coralite

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

For more information about the CLI options check out the CLI reference page

JSON
Code copied!
{
  "name": "my-coralite-site",
  "scripts": {
    "build": "coralite -t src/templates -p src/pages -o dist"
  },
  "dependencies": {
    "coralite": "^0.11.4"
  }
}

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 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

Resolve relative modules

In order to support relative imports you must enable the experimental --experimental-import-meta-resolve option


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