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:
coralite [options]
Options #
The Coralite CLI accepts several options to configure its behavior. Here's a detailed list of available options:
-
-c, --components <path>(required)- Description: The file system path to the directory containing Coralite component files.
- Example:
--components path/to/components
-
-p, --pages <path>(required)- Description: The file system path to the directory containing page files that will be rendered.
- Example:
--pages path/to/pages
-
-o, --output <path>(required)- Description: The output directory for the generated site. If the specified directory does not exist, it will be created.
- Example:
--output path/to/dist
-
-m, --mode <mode>(optional)- Description: The build mode. Can be
"production"or"development". Default is"production". - Example:
--mode development
- Description: The build mode. Can be
-
-i, --ignore-attribute <key=value...>(optional)- Description: Ignore elements by attribute name-value pair during parsing. Multiple pairs can be provided separated by spaces.
- Examples:
- Ignore
<div data-ignore>elements:--ignore-attribute data-ignore=true - Ignore multiple elements:
--ignore-attribute data-ignore=true class=test-only
- Ignore
-
-s, --skip-render-attribute <key...>(optional)- Description: Parse elements but exclude them from final render output based on attribute presence.
- Example:
--skip-render-attribute data-client-only
-
-d, --dry-run(optional)- Description: Run the CLI in dry-run mode. This displays information about generated documents and their content without actually writing files to the output directory.
- Example:
coralite -c src/components -p src/pages -o dist --dry-run
-
-a, --assets <mapping...>(optional)- Description: Static assets to copy during build from NPM packages to the output directory. Format is
pkg:path:dest(orpkg:pathwhere destination defaults to path). Multiple mappings can be provided separated by spaces. - Examples:
- Copy specific file:
--assets my-package:dist/style.css:assets/style.css - Copy and keep same path:
--assets my-package:dist/logo.png
- Copy specific file:
- Description: Static assets to copy during build from NPM packages to the output directory. Format is
Configuration File Support #
The Coralite CLI automatically looks for a coralite.config.js file in the current working directory. If found, it will merge its configuration with the CLI options.
Examples #
1. Generate a site with default options:
coralite -c src/components -p src/pages -o dist
2. Ignore specific elements during parsing and run in dry-run mode:
coralite -c src/components -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 it:
coralite -c src/components -p src/pages -o dist