gramax-cli v1.0.7
gramax-cli
Gramax CLI is a versatile command-line tool designed to help developers generate static sites effortlessly from source directories created using the Gramax editor. Below is the official documentation to get you started.
Key Features
Static Site Generation: Create static websites from specified directories with a single command.
Error Checking: Validate catalogs and identify issues before deployment.
Installation
You can use Gramax CLI in two ways: without installation via npx
or by installing it globally.
Run Without Installation
Use npx
to run Gramax CLI without installing it:
npx gramax-cli <command> [options]
Install Globally
Install Gramax CLI globally for frequent usage:
npm install -g gramax-cli
After installation, you can run the CLI from anywhere:
gramax-cli <command> [options]
Commands Overview
Build Command
The build
command generates a static site from the specified source directory.
gramax-cli build --source <path> --destination <path> [--skip-check]
Options
Option | Description | Default |
---|---|---|
--source, -s | Path to the source directory created using the Gramax editor. | Current working directory |
--destination, -d | Path where the generated static site will be saved. | ./build |
--skip-check | Skips validation checks during the build process. | false |
Configuration
Customize the build process using a gramax.config.yaml
file in the source directory or environment variables.
Example gramax.config.yaml
:
build:
logo:
imageUrl: "https://example.com/logo.png"
linkUrl: "https://example.com"
metrics:
yandex:
metricCounter: 12345678
matomo:
siteId: 1
matomoUrl: "https://example.com/matomo"
matomoContainerUrl: "https://example.com/container"
Environment Variable Overrides:
LOGO_LINK_URL
LOGO_IMAGE_URL
YANDEX_METRIC_COUNTER
MATOMO_SITE_ID
MATOMO_URL
MATOMO_CONTAINER_URL
Example
Generate a static site from ./content
and save it to ./output
:
gramax-cli build --source ./content --destination ./output
Check Command
The check
command validates the specified catalog directory for errors.
gramax-cli check --destination <path> [--output <path>]
Options
Option | Description | Default |
---|---|---|
--destination, -d | Path to the catalog directory for validation. | Current working directory |
--output, -o | Path where the validation log file will be saved. | Not specified |
Example
Run a check on ./catalog
and save the validation log to ./error-log.txt
:
gramax-cli check --destination ./catalog --output ./error-log.txt
Export Command
The export
command exports the specified catalog directory to a document format (docx or pdf).
gramax-cli export --source <path> --output <path> [--format <format>] [--yes]
Options
Option | Description | Default |
---|---|---|
--source, -s | Path to the catalog directory for export. | Current working directory |
--output, -o | Path where the generated file will be saved. | ./export |
--format, -f | Export format: docx or pdf. | docx |
--yes, -y | Skip confirmation. | false |
Example
Export catalog from ./content
to ./output.docx
:
gramax-cli export --source ./content --output ./output.docx
Export catalog to PDF format:
gramax-cli export --source ./content --output ./output.pdf --format pdf
Utility Commands
Version Command
Display the current version of Gramax CLI:
gramax-cli --version
Help Command
View all available commands and their options:
gramax-cli --help
License
Gramax CLI is licensed under the GNU General Public License v3.0.