@sylphx/leaf-cli
v1.0.0
Published
π Command-line interface for Leaf documentation framework
Readme
@sylphx/leaf-cli
π Command-line interface for Leaf documentation framework
Zero-config documentation tool that includes everything you need to build beautiful docs.
Quick Start
# 1. Install
npm install -D @sylphx/leaf-cli
# 2. Create a doc
mkdir docs
echo '# Hello World' > docs/index.md
# 3. Start dev server
npx leaf devOpen http://localhost:5173 π
Installation
Choose your preferred package manager:
# npm
npm install -D @sylphx/leaf-cli
# bun
bun add -D @sylphx/leaf-cli
# pnpm
pnpm add -D @sylphx/leaf-cli
# yarn
yarn add -D @sylphx/leaf-cliWhat's included:
@sylphx/leaf- Core framework@sylphx/leaf-theme-default- Default theme- All CLI commands
Commands
Development Server
Start dev server with hot reload:
npx leaf dev [options]
Options:
--port <port> Specify port (default: 5173)
--host <host> Specify host (default: localhost)
--open Open browser automaticallyBuild for Production
Generate static HTML files:
npx leaf build [options]
Options:
--outDir <dir> Output directory (default: dist)Preview Production Build
Test your production build locally:
npx leaf preview [options]
Options:
--port <port> Specify port (default: 4173)Configuration (Optional)
Create leaf.config.ts in your project root:
import { defineConfig } from '@sylphx/leaf';
export default defineConfig({
title: 'My Documentation',
description: 'My awesome docs',
theme: {
nav: [
{ text: 'Guide', link: '/guide' },
{ text: 'API', link: '/api' }
],
sidebar: [
{ text: 'Introduction', link: '/' },
{ text: 'Getting Started', link: '/getting-started' }
]
}
});Leaf works with zero configuration - config is completely optional!
Project Structure
my-docs/
βββ docs/ # Your markdown files
β βββ index.md
β βββ guide/
β βββ api/
βββ leaf.config.ts # Optional configuration
βββ package.jsonFeatures
- β‘ Fast Development - Hot reload with Vite
- π¦ Zero Config - Works out of the box
- π¨ Beautiful Theme - Responsive design with dark mode
- π Local Search - Built-in fuzzy search (Cmd/Ctrl+K)
- π Full Markdown - GFM, code highlighting, math, diagrams
- π± Mobile Friendly - Responsive design
- π Dark Mode - System preference detection
Usage with Different Package Managers
npm
npx leaf dev
npx leaf build
npx leaf previewbun
bunx leaf dev
bunx leaf build
bunx leaf previewpnpm
pnpm leaf dev
pnpm leaf build
pnpm leaf previewyarn
yarn leaf dev
yarn leaf build
yarn leaf previewTroubleshooting
Command not found
Make sure you installed the CLI:
npm install -D @sylphx/leaf-cliThen use npx to run:
npx leaf devPort already in use
Specify a different port:
npx leaf dev --port 3000Module not found
Clear cache and reinstall:
rm -rf node_modules
npm installDocumentation
- π Full Documentation
- π Getting Started Guide
- π Report Issues
License
MIT Β© Sylphx
