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-cliAfter 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_URLLOGO_IMAGE_URLYANDEX_METRIC_COUNTERMATOMO_SITE_IDMATOMO_URLMATOMO_CONTAINER_URL
Example
Generate a static site from ./content and save it to ./output:
gramax-cli build --source ./content --destination ./outputCheck 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.txtExport 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.docxExport catalog to PDF format:
gramax-cli export --source ./content --output ./output.pdf --format pdfUtility Commands
Version Command
Display the current version of Gramax CLI:
gramax-cli --versionHelp Command
View all available commands and their options:
gramax-cli --helpLicense
Gramax CLI is licensed under the GNU General Public License v3.0.