CLI
Methanol includes a dedicated Command-line Interface (CLI) designed to streamline development, execution of static builds, and local previews.
Core Commands
Quick start with npx (recommended):
npx methanol dev # Initialize the development server
npx methanol build # Execute production build to the dist/ directory
npx methanol serve # Preview the production build locally
For improved performance and faster startup times, consider a global installation:
npm install methanol -g
methanol dev
The input and output paths can be provided as positional arguments (order is significant):
npx methanol build ./pages ./dist
In dev mode, only the input argument is utilized:
npx methanol dev ./pages
For serve/preview, the first positional argument is treated as the output directory:
npx methanol serve ./dist
Flag Reference
--input,-i: Specifies the source directory (overrides the defaultpages/).--components: Specifies the components directory (overrides the defaultcomponents/).--assets: Specifies the static assets directory (overrides the defaultpublic/).--output,-o: Specifies the build destination (overrides the defaultdist/).--config,-c: Defines the path to a custom configuration file.--theme: Overrides thethemeconfiguration. When a string is provided, Methanol first attempts to resolve it as a built-in theme (e.g.,default,blog). If not found, it searches for a package namedmethanol-theme-xxx(wherexxxis the provided string). For local themes, import them inmethanol.config.*and setthemeto the imported theme object/factory.--site-name: Overrides the site title defined in configuration.--owner: Overrides the site owner (site.owner).--base: Temporarily overridessite.basefor the current execution (ignored indevmode).--port: Sets the port for the development and preview servers (default: 5173).--host: Binds the server to a specific host (using--hostwithout a value binds to all interfaces).--intermediate-dir: Directory for intermediate HTML output (build only).--emit-intermediate: Enables the output of intermediate HTML tobuild/(build only).--highlight/--no-highlight: Controls syntax highlighting.--jobs,-j: Sets the build worker thread count (0auto scales with page count).--search/--no-search: Controls Pagefind search indexing.--rss/--no-rss: Controls RSS/Atom feed generation.--atom/--no-atom: Outputs Atom when enabled (--rssis implied).--pwa/--no-pwa: Controls PWA support.-v,--verbose: Enables detailed logging, including Vite and Pagefind output during the build process.
Syntax highlighting is enabled by default and can be disabled per-execution via --no-highlight.
Execution via Node
node node_modules/methanol/bin/methanol.js dev