Skip to main content

Coralite CLI

This technical documentation provides an in-depth overview of the Coralite CLI, its command-line options, and usage examples.

Command Structure #

The basic command structure for the Coralite CLI is as follows:

bash
Code copied!
coralite [options]

Options #

The Coralite CLI accepts several options to configure its behavior. Here's a detailed list of available options:

Configuration File Support #

The Coralite CLI automatically looks for a coralite.config.js file in the current working directory. If found, it will merge any plugins defined in the configuration file with the CLI options.

Examples #

1. Generate a site with default options:

bash
Code copied!
coralite -t src/templates -p src/pages -o dist

2. Ignore specific elements during parsing and run in dry-run mode:

bash
Code copied!
coralite -t src/templates -p src/pages -o dist --ignore-attribute data-ignore=true class=test-only --dry-run

3. Using with a configuration file:

When a coralite.config.js file exists in your project root, the CLI will automatically load plugins from it:

bash
Code copied!
coralite -t src/templates -p src/pages -o dist

Technical Details #

Under the hood, the Coralite CLI does the following:

  1. Parses command-line options using the commander library.
  2. Validates and processes provided options (e.g., splits ignore attribute key-value pairs).
  3. Checks for and loads plugins from coralite.config.js if it exists.
  4. Creates a Coralite instance with the combined options.
  5. Initializes the Coralite instance and compiles all pages.
  6. Based on the --dry-run option, either displays generated document information or writes rendered HTML files to the specified output directory.

Start Building with Coralite!

Use the scaffolding script to get jump started into your next project with Coralite

Copied commandline!