Ghost Theme Preview
A lightweight, zero-config tool for previewing Ghost themes without running a full Ghost installation. Perfect for theme developers who want to test their Handlebars templates with mock data.
Installation
npm install -g gpreview
npx gpreview /path/to/your/theme
Quick Start
gpreview
gpreview ./my-ghost-theme
gpreview ./my-ghost-theme -p 8080
Features
- 🚀 Zero Configuration - Works out of the box with sensible defaults
- 🎨 Full Theme Support - Renders all standard Ghost templates (index, post, page, tag, author)
- 🔧 Ghost Helpers - Implements all essential Ghost Handlebars helpers
- 📦 Built-in Mock Data - Includes sample posts, authors, tags, and pages
- 🔄 Hot Reload - Changes to theme files are reflected immediately
- 📁 Static Assets - Automatically serves CSS, JS, and images from your theme
- 🎯 Template Fallbacks - Gracefully handles missing templates
Usage
CLI Options
gpreview [theme-path] [options]
theme-path - Path to Ghost theme directory (default: current directory)
-p, --port <number> - Port to run server on (default: 3000)
-d, --data <path> - Path to custom mock data JSON file
-w, --watch - Watch theme files for changes and auto-reload
-V, --version - Output the version number
-h, --help - Display help for command
Examples
gpreview
gpreview /path/to/casper
gpreview ./my-theme -p 8080
gpreview ./my-theme -w
API Integration
You can also use this package programmatically:
const { PreviewServer } = require('gpreview');
const server = new PreviewServer({
themePath: './my-theme',
port: 3000,
});
server.start().then(() => {
console.log('Theme preview running on http://localhost:3000');
});
Development
npm install
npm run build
npm run preview dawn
npm test