
Frontend Slides
- 2 installs
- 5 repo stars
- Updated May 27, 2026
- sugarforever/frontend-slides
Create animation-rich, zero-dependency HTML presentations from scratch or by converting PowerPoint files, with strict viewport-fitting rules per slide.
About
Builds self-contained animated HTML presentations from scratch or from .pptx files, enforcing distinctive design and strict 100vh viewport fitting per slide. A developer uses it to create slides for a talk, pitch, or PPT-to-web conversion.
- Single-file HTML, inline CSS/JS, no build tools
- Non-negotiable viewport fitting; clamp() sizing and reduced-motion support
Frontend Slides by the numbers
- 2 all-time installs (skills.sh)
- Ranked #1,562 of 1,880 Design & UI/UX skills by installs in the Skillselion catalog
- Data as of Jul 27, 2026 (Skillselion catalog sync)
npx skills add https://github.com/sugarforever/frontend-slides --skill frontend-slidesAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2 |
|---|---|
| repo stars | ★ 5 |
| Last updated | May 27, 2026 |
| Repository | sugarforever/frontend-slides ↗ |
What it does
Create animation-rich, zero-dependency HTML presentations from scratch or by converting PowerPoint files, with strict viewport-fitting rules per slide.
Files
../../../../SKILL.md
{
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
"name": "frontend-slides",
"description": "Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files.",
"owner": {
"name": "zarazhangrui",
"url": "https://github.com/zarazhangrui"
},
"plugins": [
{
"name": "frontend-slides",
"description": "Zero-dependency HTML presentation generator with 12 curated visual themes, PPT conversion, and anti-AI-slop design philosophy.",
"source": "./plugins/frontend-slides",
"category": "productivity",
"tags": ["presentations", "slides", "html", "design", "powerpoint"]
}
]
}
Animation Patterns Reference
Use this reference when generating presentations. Match animations to the intended feeling.
Effect-to-Feeling Guide
| Feeling | Animations | Visual Cues |
|---|---|---|
| Dramatic / Cinematic | Slow fade-ins (1-1.5s), large scale transitions (0.9 to 1), parallax scrolling | Dark backgrounds, spotlight effects, full-bleed images |
| Techy / Futuristic | Neon glow (box-shadow), glitch/scramble text, grid reveals | Particle systems (canvas), grid patterns, monospace accents, cyan/magenta/electric blue |
| Playful / Friendly | Bouncy easing (spring physics), floating/bobbing | Rounded corners, pastel/bright colors, hand-drawn elements |
| Professional / Corporate | Subtle fast animations (200-300ms), clean slides | Navy/slate/charcoal, precise spacing, data visualization focus |
| Calm / Minimal | Very slow subtle motion, gentle fades | High whitespace, muted palette, serif typography, generous padding |
| Editorial / Magazine | Staggered text reveals, image-text interplay | Strong type hierarchy, pull quotes, grid-breaking layouts, serif headlines + sans body |
Entrance Animations
/* Fade + Slide Up (most versatile) */
.reveal {
opacity: 0;
transform: translateY(30px);
transition: opacity 0.6s var(--ease-out-expo),
transform 0.6s var(--ease-out-expo);
}
.visible .reveal {
opacity: 1;
transform: translateY(0);
}
/* Scale In */
.reveal-scale {
opacity: 0;
transform: scale(0.9);
transition: opacity 0.6s, transform 0.6s var(--ease-out-expo);
}
/* Slide from Left */
.reveal-left {
opacity: 0;
transform: translateX(-50px);
transition: opacity 0.6s, transform 0.6s var(--ease-out-expo);
}
/* Blur In */
.reveal-blur {
opacity: 0;
filter: blur(10px);
transition: opacity 0.8s, filter 0.8s var(--ease-out-expo);
}Background Effects
/* Gradient Mesh — layered radial gradients for depth */
.gradient-bg {
background:
radial-gradient(ellipse at 20% 80%, rgba(120, 0, 255, 0.3) 0%, transparent 50%),
radial-gradient(ellipse at 80% 20%, rgba(0, 255, 200, 0.2) 0%, transparent 50%),
var(--bg-primary);
}
/* Noise Texture — inline SVG for grain */
.noise-bg {
background-image: url("data:image/svg+xml,..."); /* Inline SVG noise */
}
/* Grid Pattern — subtle structural lines */
.grid-bg {
background-image:
linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
background-size: 50px 50px;
}Interactive Effects
/* 3D Tilt on Hover — adds depth to cards/panels */
class TiltEffect {
constructor(element) {
this.element = element;
this.element.style.transformStyle = 'preserve-3d';
this.element.style.perspective = '1000px';
this.element.addEventListener('mousemove', (e) => {
const rect = this.element.getBoundingClientRect();
const x = (e.clientX - rect.left) / rect.width - 0.5;
const y = (e.clientY - rect.top) / rect.height - 0.5;
this.element.style.transform = `rotateY(${x * 10}deg) rotateX(${-y * 10}deg)`;
});
this.element.addEventListener('mouseleave', () => {
this.element.style.transform = 'rotateY(0) rotateX(0)';
});
}
}Troubleshooting
| Problem | Fix |
|---|---|
| Fonts not loading | Check Fontshare/Google Fonts URL; ensure font names match in CSS |
| Animations not triggering | Verify Intersection Observer is running; check .visible class is being added |
| Scroll snap not working | Ensure scroll-snap-type: y mandatory on html; each slide needs scroll-snap-align: start |
| Mobile issues | Disable heavy effects at 768px breakpoint; test touch events; reduce particle count |
| Performance issues | Use will-change sparingly; prefer transform/opacity animations; throttle scroll handlers |
HTML Presentation Template
Reference architecture for generating slide presentations. Every presentation follows this structure.
Base HTML Structure
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Presentation Title</title>
<!-- Fonts: use Fontshare or Google Fonts — never system fonts -->
<link rel="stylesheet" href="https://api.fontshare.com/v2/css?f[]=..." />
<style>
/* ===========================================
CSS CUSTOM PROPERTIES (THEME)
Change these to change the whole look
=========================================== */
:root {
/* Colors — from chosen style preset */
--bg-primary: #0a0f1c;
--bg-secondary: #111827;
--text-primary: #ffffff;
--text-secondary: #9ca3af;
--accent: #00ffcc;
--accent-glow: rgba(0, 255, 204, 0.3);
/* Typography — MUST use clamp() */
--font-display: "Clash Display", sans-serif;
--font-body: "Satoshi", sans-serif;
--title-size: clamp(2rem, 6vw, 5rem);
--subtitle-size: clamp(0.875rem, 2vw, 1.25rem);
--body-size: clamp(0.75rem, 1.2vw, 1rem);
/* Spacing — MUST use clamp() */
--slide-padding: clamp(1.5rem, 4vw, 4rem);
--content-gap: clamp(1rem, 2vw, 2rem);
/* Animation */
--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
--duration-normal: 0.6s;
}
/* ===========================================
BASE STYLES
=========================================== */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* --- PASTE viewport-base.css CONTENTS HERE --- */
/* ===========================================
ANIMATIONS
Trigger via .visible class (added by JS on scroll)
=========================================== */
.reveal {
opacity: 0;
transform: translateY(30px);
transition:
opacity var(--duration-normal) var(--ease-out-expo),
transform var(--duration-normal) var(--ease-out-expo);
}
.slide.visible .reveal {
opacity: 1;
transform: translateY(0);
}
/* Stagger children for sequential reveal */
.reveal:nth-child(1) {
transition-delay: 0.1s;
}
.reveal:nth-child(2) {
transition-delay: 0.2s;
}
.reveal:nth-child(3) {
transition-delay: 0.3s;
}
.reveal:nth-child(4) {
transition-delay: 0.4s;
}
/* ... preset-specific styles ... */
</style>
</head>
<body>
<!-- Optional: Progress bar -->
<div class="progress-bar"></div>
<!-- Optional: Navigation dots -->
<nav class="nav-dots"><!-- Generated by JS --></nav>
<!-- Slides -->
<section class="slide title-slide">
<h1 class="reveal">Presentation Title</h1>
<p class="reveal">Subtitle or author</p>
</section>
<section class="slide">
<div class="slide-content">
<h2 class="reveal">Slide Title</h2>
<p class="reveal">Content...</p>
</div>
</section>
<!-- More slides... -->
<script>
/* ===========================================
SLIDE PRESENTATION CONTROLLER
=========================================== */
class SlidePresentation {
constructor() {
this.slides = document.querySelectorAll(".slide");
this.currentSlide = 0;
this.setupIntersectionObserver();
this.setupKeyboardNav();
this.setupTouchNav();
this.setupProgressBar();
this.setupNavDots();
}
setupIntersectionObserver() {
// Add .visible class when slides enter viewport
// Triggers CSS animations efficiently
}
setupKeyboardNav() {
// Arrow keys, Space, Page Up/Down
}
setupTouchNav() {
// Touch/swipe support for mobile
}
setupProgressBar() {
// Update progress bar on scroll
}
setupNavDots() {
// IMPORTANT: Always clear before building — if outerHTML was
// captured while dots were rendered, re-opening the file would
// append a duplicate set on top of the existing ones.
this.navDotsContainer.innerHTML = "";
// Generate and manage navigation dots
}
}
new SlidePresentation();
</script>
</body>
</html>Mobile Layout Conventions
viewport-base.css provides several mobile-friendly defaults at max-width: 600px. Decks that follow these naming conventions get touch-friendly behavior automatically — no extra media queries needed:
- `.nav-dots` — relocates from right-edge vertical rail to a centered bottom-bar pill with backdrop-blur. Ergonomic for one-handed swiping; doesn't overlap content at narrow widths.
- `pre`, `code`, `.code-block`, `.terminal`, `.term` — long URLs and command lines wrap (
overflow-wrap: anywhere) instead of blowing out the viewport. - `.two-col`, `.compare`, `.side-by-side`, `.cards-2x2`, `.cards-grid` — multi-column grids collapse to a single column.
When designing dense slides (quote stacks, paired diff blocks, four-card overviews), also shrink monospace font sizes for phones explicitly via clamp():
@media (max-width: 600px) {
.code-block { font-size: clamp(0.66rem, 2.6vw, 0.78rem); }
.quote-card .quote-en { font-size: clamp(0.74rem, 2.4vw, 0.88rem); }
}viewport-base.css uses !important on its mobile overrides because preset CSS is inlined after the base file — without !important, equal-specificity selectors in your preset would silently win. Don't fight this: skip writing mobile-position overrides for .nav-dots in your preset and let the base handle it.
Required JavaScript Features
Every presentation must include:
1. SlidePresentation Class — Main controller with:
- Keyboard navigation (arrows, space, page up/down)
- Touch/swipe support
- Mouse wheel navigation
- Progress bar updates
- Navigation dots
2. Intersection Observer — For scroll-triggered animations:
- Add
.visibleclass when slides enter viewport - Trigger CSS transitions efficiently
3. Optional Enhancements (match to chosen style):
- Custom cursor with trail
- Particle system background (canvas)
- Parallax effects
- 3D tilt on hover
- Magnetic buttons
- Counter animations
4. Inline Editing (only if user opted in during Phase 1 — skip entirely if they said No):
- Edit toggle button (hidden by default, revealed via hover hotzone or
Ekey) - Auto-save to localStorage
- Export/save file functionality
- See "Inline Editing Implementation" section below
Inline Editing Implementation (Opt-In Only)
If the user chose "No" for inline editing in Phase 1, do NOT generate any edit-related HTML, CSS, or JS.
Do NOT use CSS `~` sibling selector for hover-based show/hide. The CSS-only approach (edit-hotzone:hover ~ .edit-toggle) fails because pointer-events: none on the toggle button breaks the hover chain: user hovers hotzone -> button becomes visible -> mouse moves toward button -> leaves hotzone -> button disappears before click.
Required approach: JS-based hover with 400ms delay timeout.
HTML:
<div class="edit-hotzone"></div>
<button class="edit-toggle" id="editToggle" title="Edit mode (E)">✏️</button>CSS (visibility controlled by JS classes only):
/* Do NOT use CSS ~ sibling selector for this!
pointer-events: none breaks the hover chain.
Must use JS with delay timeout. */
.edit-hotzone {
position: fixed;
top: 0;
left: 0;
width: 80px;
height: 80px;
z-index: 10000;
cursor: pointer;
}
.edit-toggle {
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
z-index: 10001;
}
.edit-toggle.show,
.edit-toggle.active {
opacity: 1;
pointer-events: auto;
}JS (three interaction methods):
// 1. Click handler on the toggle button
document.getElementById("editToggle").addEventListener("click", () => {
editor.toggleEditMode();
});
// 2. Hotzone hover with 400ms grace period
const hotzone = document.querySelector(".edit-hotzone");
const editToggle = document.getElementById("editToggle");
let hideTimeout = null;
hotzone.addEventListener("mouseenter", () => {
clearTimeout(hideTimeout);
editToggle.classList.add("show");
});
hotzone.addEventListener("mouseleave", () => {
hideTimeout = setTimeout(() => {
if (!editor.isActive) editToggle.classList.remove("show");
}, 400);
});
editToggle.addEventListener("mouseenter", () => {
clearTimeout(hideTimeout);
});
editToggle.addEventListener("mouseleave", () => {
hideTimeout = setTimeout(() => {
if (!editor.isActive) editToggle.classList.remove("show");
}, 400);
});
// 3. Hotzone direct click
hotzone.addEventListener("click", () => {
editor.toggleEditMode();
});
// 4. Keyboard shortcut (E key, skip when editing text)
document.addEventListener("keydown", (e) => {
if (
(e.key === "e" || e.key === "E") &&
!e.target.getAttribute("contenteditable")
) {
editor.toggleEditMode();
}
});CRITICAL: `exportFile()` must strip edit state before capturing outerHTML.
When the user presses Ctrl+S in edit mode, document.documentElement.outerHTML captures the live DOM — including body.edit-active, contenteditable="true" on every text element, and .active/.show classes on the toggle button and banner. Anyone opening the saved file sees dashed outlines, a checkmark button, and an edit banner, as if permanently stuck in edit mode.
Always implement exportFile() like this:
exportFile() {
// Temporarily strip edit state so the saved file opens cleanly
const editableEls = Array.from(document.querySelectorAll('[contenteditable]'));
editableEls.forEach(el => el.removeAttribute('contenteditable'));
document.body.classList.remove('edit-active');
// Also strip UI classes from toggle button and banner
const editToggle = document.getElementById('editToggle');
const editBanner = document.querySelector('.edit-banner');
editToggle?.classList.remove('active', 'show');
editBanner?.classList.remove('active', 'show');
const html = '<!DOCTYPE html>\n' + document.documentElement.outerHTML;
// Restore edit state so the user can keep editing
document.body.classList.add('edit-active');
editableEls.forEach(el => el.setAttribute('contenteditable', 'true'));
editToggle?.classList.add('active');
editBanner?.classList.add('active');
const blob = new Blob([html], { type: 'text/html' });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'presentation.html';
a.click();
URL.revokeObjectURL(a.href);
}Image Pipeline (Skip If No Images)
If user chose "No images" in Phase 1, skip this entirely. If images were provided, process them before generating HTML.
Dependency: pip install Pillow
Image Processing
from PIL import Image, ImageDraw
# Circular crop (for logos on modern/clean styles)
def crop_circle(input_path, output_path):
img = Image.open(input_path).convert('RGBA')
w, h = img.size
size = min(w, h)
left, top = (w - size) // 2, (h - size) // 2
img = img.crop((left, top, left + size, top + size))
mask = Image.new('L', (size, size), 0)
ImageDraw.Draw(mask).ellipse([0, 0, size, size], fill=255)
img.putalpha(mask)
img.save(output_path, 'PNG')
# Resize (for oversized images that inflate HTML)
def resize_max(input_path, output_path, max_dim=1200):
img = Image.open(input_path)
img.thumbnail((max_dim, max_dim), Image.LANCZOS)
img.save(output_path, quality=85)| Situation | Operation |
|---|---|
| Square logo on rounded aesthetic | crop_circle() |
| Image > 1MB | resize_max(max_dim=1200) |
| Wrong aspect ratio | Manual crop with img.crop() |
Save processed images with _processed suffix. Never overwrite originals.
Image Placement
Use direct file paths (not base64) — presentations are viewed locally:
<img src="assets/logo_round.png" alt="Logo" class="slide-image logo" />
<img
src="assets/screenshot.png"
alt="Screenshot"
class="slide-image screenshot"
/>.slide-image {
max-width: 100%;
max-height: min(50vh, 400px);
object-fit: contain;
border-radius: 8px;
}
.slide-image.screenshot {
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.slide-image.logo {
max-height: min(30vh, 200px);
}Adapt border/shadow colors to match the chosen style's accent. Never repeat the same image on multiple slides (except logos on title + closing).
Placement patterns: Logo centered on title slide. Screenshots in two-column layouts with text. Full-bleed images as slide backgrounds with text overlay (use sparingly).
---
Code Quality
Comments: Every section needs clear comments explaining what it does and how to modify it.
Accessibility:
- Semantic HTML (
<section>,<nav>,<main>) - Keyboard navigation works fully
- ARIA labels where needed
prefers-reduced-motionsupport (included in viewport-base.css)
File Structure
Single presentations:
presentation.html # Self-contained, all CSS/JS inline
assets/ # Images only, if anyMultiple presentations in one project:
[name].html
[name]-assets/MIT License
Copyright (c) 2025 Zara Zhang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
{
"name": "frontend-slides",
"version": "1.0.0",
"description": "Zero-dependency HTML presentation generator with 12 curated visual themes, PPT conversion, and anti-AI-slop design philosophy.",
"author": {
"name": "zarazhangrui",
"url": "https://github.com/zarazhangrui"
},
"homepage": "https://github.com/zarazhangrui/frontend-slides",
"repository": "https://github.com/zarazhangrui/frontend-slides",
"license": "MIT",
"keywords": ["presentations", "slides", "html", "design", "powerpoint", "animations"]
}
../../../../animation-patterns.md
../../../../html-template.md
../../../../../scripts/deploy.sh../../../../../scripts/export-pdf.sh../../../../../scripts/extract-pptx.py../../../../STYLE_PRESETS.md
../../../../viewport-base.cssFrontend Slides
A Claude Code skill for creating stunning, animation-rich HTML presentations — from scratch or by converting PowerPoint files.
What This Does
Frontend Slides helps non-designers create beautiful web presentations without knowing CSS or JavaScript. It uses a "show, don't tell" approach: instead of asking you to describe your aesthetic preferences in words, it generates visual previews and lets you pick what you like.
Here is a deck about the skill, made through the skill:
https://github.com/user-attachments/assets/ef57333e-f879-432a-afb9-180388982478
Key Features
- Zero Dependencies — Single HTML files with inline CSS/JS. No npm, no build tools, no frameworks.
- Visual Style Discovery — Can't articulate design preferences? No problem. Pick from generated visual previews.
- PPT Conversion — Convert existing PowerPoint files to web, preserving all images and content.
- Anti-AI-Slop — Curated distinctive styles that avoid generic AI aesthetics (bye-bye, purple gradients on white).
- Production Quality — Accessible, responsive, well-commented code you can customize.
Installation
Via Plugin Marketplace (Recommended)
Install directly from Claude Code in two commands:
/plugin marketplace add zarazhangrui/frontend-slides
/plugin install frontend-slides@frontend-slidesThen use it by typing /frontend-slides in Claude Code.
Manual Installation
Copy the skill files to your Claude Code skills directory:
# Create the skill directory
mkdir -p ~/.claude/skills/frontend-slides/scripts
# Copy all files (or clone this repo directly)
cp SKILL.md STYLE_PRESETS.md viewport-base.css html-template.md animation-patterns.md ~/.claude/skills/frontend-slides/
cp scripts/extract-pptx.py ~/.claude/skills/frontend-slides/scripts/Or clone directly:
git clone https://github.com/zarazhangrui/frontend-slides.git ~/.claude/skills/frontend-slidesThen use it by typing /frontend-slides in Claude Code.
Usage
Create a New Presentation
/frontend-slides
> "I want to create a pitch deck for my AI startup"The skill will:
1. Ask about your content (slides, messages, images) 2. Ask about the feeling you want (impressed? excited? calm?) 3. Generate 3 visual style previews for you to compare 4. Create the full presentation in your chosen style 5. Open it in your browser
Convert a PowerPoint
/frontend-slides
> "Convert my presentation.pptx to a web slideshow"The skill will:
1. Extract all text, images, and notes from your PPT 2. Show you the extracted content for confirmation 3. Let you pick a visual style 4. Generate an HTML presentation with all your original assets
Included Styles
Dark Themes
- Bold Signal — Confident, high-impact, vibrant card on dark
- Electric Studio — Clean, professional, split-panel
- Creative Voltage — Energetic, retro-modern, electric blue + neon
- Dark Botanical — Elegant, sophisticated, warm accents
Light Themes
- Notebook Tabs — Editorial, organized, paper with colorful tabs
- Pastel Geometry — Friendly, approachable, vertical pills
- Split Pastel — Playful, modern, two-color vertical split
- Vintage Editorial — Witty, personality-driven, geometric shapes
Specialty
- Neon Cyber — Futuristic, particle backgrounds, neon glow
- Terminal Green — Developer-focused, hacker aesthetic
- Swiss Modern — Minimal, Bauhaus-inspired, geometric
- Paper & Ink — Literary, drop caps, pull quotes
Architecture
This skill uses progressive disclosure — the main SKILL.md is a concise map (~180 lines), with supporting files loaded on-demand only when needed:
| File | Purpose | Loaded When |
|---|---|---|
SKILL.md | Core workflow and rules | Always (skill invocation) |
STYLE_PRESETS.md | 12 curated visual presets | Phase 2 (style selection) |
viewport-base.css | Mandatory responsive CSS | Phase 3 (generation) |
html-template.md | HTML structure and JS features | Phase 3 (generation) |
animation-patterns.md | CSS/JS animation reference | Phase 3 (generation) |
scripts/extract-pptx.py | PPT content extraction | Phase 4 (conversion) |
scripts/deploy.sh | Deploy to Vercel | Phase 6 (sharing) |
scripts/export-pdf.sh | Export slides to PDF | Phase 6 (sharing) |
This design follows OpenAI's harness engineering principle: "give the agent a map, not a 1,000-page instruction manual."
Philosophy
This skill was born from the belief that:
1. You don't need to be a designer to make beautiful things. You just need to react to what you see.
2. Dependencies are debt. A single HTML file will work in 10 years. A React project from 2019? Good luck.
3. Generic is forgettable. Every presentation should feel custom-crafted, not template-generated.
4. Comments are kindness. Code should explain itself to future-you (or anyone else who opens it).
Sharing Your Presentations
After creating a presentation, the skill offers two ways to share it:
Deploy to a Live URL
One command deploys your slides to a permanent, shareable URL that works on any device — phones, tablets, laptops:
bash scripts/deploy.sh ./my-deck/
# or
bash scripts/deploy.sh ./presentation.htmlUses Vercel (free tier). The skill walks you through signup and login if it's your first time.
Export to PDF
Convert your slides to a PDF for email, Slack, Notion, or printing:
bash scripts/export-pdf.sh ./my-deck/index.html
bash scripts/export-pdf.sh ./presentation.html ./output.pdfUses Playwright to screenshot each slide at 1920×1080 and combine into a PDF. Installs automatically if needed. Animations are not preserved (it's a static snapshot).
Requirements
- Claude Code CLI
- For PPT conversion: Python with
python-pptxlibrary - For URL deployment: Node.js + Vercel account (free)
- For PDF export: Node.js (Playwright installs automatically)
Credits
Created by @zarazhangrui with Claude Code.
Inspired by the "Vibe Coding" philosophy — building beautiful things without being a traditional software engineer.
License
MIT — Use it, modify it, share it.
#!/usr/bin/env bash
# deploy.sh — Deploy a slide deck to Vercel for instant sharing
#
# Usage:
# bash scripts/deploy.sh <path-to-slide-folder-or-html>
#
# Examples:
# bash scripts/deploy.sh ./my-pitch-deck/
# bash scripts/deploy.sh ./presentation.html
#
# What this does:
# 1. Checks if Vercel CLI is installed (installs if not)
# 2. Checks if user is logged in (guides through login if not)
# 3. Deploys the slide deck to a public URL
# 4. Prints the live URL
#
# The deployed URL is permanent and works on any device (mobile, tablet, desktop).
# No server to maintain — Vercel hosts it for free.
set -euo pipefail
# ─── Colors ────────────────────────────────────────────────
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m'
info() { echo -e "${CYAN}ℹ${NC} $*"; }
ok() { echo -e "${GREEN}✓${NC} $*"; }
warn() { echo -e "${YELLOW}⚠${NC} $*"; }
err() { echo -e "${RED}✗${NC} $*" >&2; }
# ─── Input validation ─────────────────────────────────────
if [[ $# -lt 1 ]]; then
err "Usage: bash scripts/deploy.sh <path-to-slide-folder-or-html>"
err ""
err "Examples:"
err " bash scripts/deploy.sh ./my-pitch-deck/"
err " bash scripts/deploy.sh ./presentation.html"
exit 1
fi
INPUT="$1"
# If input is a single HTML file, create a temp directory with it as index.html
if [[ -f "$INPUT" && "$INPUT" == *.html ]]; then
DEPLOY_DIR=$(mktemp -d)
cp "$INPUT" "$DEPLOY_DIR/index.html"
PARENT_DIR=$(dirname "$INPUT")
# Parse the HTML for local file references (src="...", url('...'), href="...")
# and copy any referenced local files into the deploy directory
grep -oE '(src|href|url\()["'"'"']?[^"'"'"'>)]+' "$INPUT" 2>/dev/null | \
sed "s/^src=//; s/^href=//; s/^url(//; s/[\"']//g" | \
grep -v '^http' | grep -v '^data:' | grep -v '^#' | grep -v '^/' | \
sort -u | while read -r ref; do
# Resolve the reference relative to the HTML file's directory
SOURCE_FILE="$PARENT_DIR/$ref"
if [[ -e "$SOURCE_FILE" ]]; then
# Preserve directory structure for nested paths (e.g., assets/img.png)
TARGET_DIR="$DEPLOY_DIR/$(dirname "$ref")"
mkdir -p "$TARGET_DIR"
cp -r "$SOURCE_FILE" "$TARGET_DIR/"
fi
done
# Also copy any assets/ folder if it exists (common convention)
if [[ -d "$PARENT_DIR/assets" ]]; then
cp -r "$PARENT_DIR/assets" "$DEPLOY_DIR/assets" 2>/dev/null || true
fi
CLEANUP_TEMP=true
info "Single HTML file detected — preparing for deployment..."
elif [[ -d "$INPUT" ]]; then
# Verify the folder has an index.html
if [[ ! -f "$INPUT/index.html" ]]; then
err "Folder '$INPUT' does not contain an index.html file."
err "Make sure your presentation folder has an index.html."
exit 1
fi
DEPLOY_DIR="$INPUT"
CLEANUP_TEMP=false
else
err "'$INPUT' is not a valid HTML file or directory."
exit 1
fi
# ─── Step 1: Check for Vercel CLI ─────────────────────────
echo ""
echo -e "${BOLD}╔══════════════════════════════════════╗${NC}"
echo -e "${BOLD}║ Deploy Slides to Vercel ║${NC}"
echo -e "${BOLD}╚══════════════════════════════════════╝${NC}"
echo ""
if ! command -v npx &>/dev/null; then
err "Node.js is required but not installed."
err ""
err "Install Node.js:"
err " macOS: brew install node"
err " or visit https://nodejs.org and download the installer"
exit 1
fi
info "Checking Vercel CLI..."
# Check if vercel is available (either globally or via npx)
if command -v vercel &>/dev/null; then
VERCEL_CMD="vercel"
ok "Vercel CLI found"
elif npx --yes vercel --version &>/dev/null 2>&1; then
VERCEL_CMD="npx --yes vercel"
ok "Vercel CLI available via npx"
else
info "Installing Vercel CLI..."
npm install -g vercel
VERCEL_CMD="vercel"
ok "Vercel CLI installed"
fi
# ─── Step 2: Check login status ───────────────────────────
echo ""
info "Checking Vercel login status..."
# Try to check if logged in by running whoami
if ! $VERCEL_CMD whoami &>/dev/null 2>&1; then
echo ""
warn "You're not logged in to Vercel yet."
echo ""
echo -e "${BOLD}To log in, run this command and follow the prompts:${NC}"
echo ""
echo " vercel login"
echo ""
echo "If you don't have a Vercel account yet:"
echo " 1. Go to https://vercel.com/signup"
echo " 2. Sign up with GitHub, GitLab, email, or any method"
echo " 3. Come back here and run: vercel login"
echo " 4. Then re-run this deploy script"
echo ""
# Try interactive login
echo -e "${YELLOW}Attempting interactive login now...${NC}"
echo ""
$VERCEL_CMD login || {
err "Login failed. Please run 'vercel login' manually and try again."
[[ "$CLEANUP_TEMP" == "true" ]] && rm -rf "$DEPLOY_DIR"
exit 1
}
echo ""
ok "Logged in to Vercel!"
fi
VERCEL_USER=$($VERCEL_CMD whoami 2>/dev/null || echo "unknown")
ok "Logged in as: $VERCEL_USER"
# ─── Step 3: Deploy ───────────────────────────────────────
echo ""
info "Deploying slides..."
echo ""
# Deploy with sensible defaults:
# --yes: skip confirmation prompts
# --prod: deploy to production URL (not preview)
# --name: use the folder name as the project name
DECK_NAME=$(basename "$DEPLOY_DIR")
# If we used a temp dir, use the original filename without .html
if [[ "$CLEANUP_TEMP" == "true" ]]; then
DECK_NAME=$(basename "$INPUT" .html)
fi
# Sanitize project name for Vercel:
# - lowercase, replace spaces/special chars with hyphens
# - collapse multiple hyphens, trim to 100 chars
DECK_NAME=$(echo "$DECK_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9._-]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//' | cut -c1-100)
# Vercel uses the directory name as the project name, so rename the deploy
# directory to the sanitized deck name (avoids deprecated --name flag)
if [[ "$CLEANUP_TEMP" == "true" ]]; then
RENAMED_DIR="$(dirname "$DEPLOY_DIR")/$DECK_NAME"
mv "$DEPLOY_DIR" "$RENAMED_DIR"
DEPLOY_DIR="$RENAMED_DIR"
fi
DEPLOY_OUTPUT=$($VERCEL_CMD deploy "$DEPLOY_DIR" --yes --prod 2>&1) || {
err "Deployment failed:"
echo "$DEPLOY_OUTPUT"
[[ "$CLEANUP_TEMP" == "true" ]] && rm -rf "$DEPLOY_DIR"
exit 1
}
# Extract the URL from output
DEPLOY_URL=$(echo "$DEPLOY_OUTPUT" | grep -o 'https://[^ ]*' | tail -1)
# ─── Step 4: Success ──────────────────────────────────────
echo ""
echo -e "${BOLD}════════════════════════════════════════${NC}"
ok "Slides deployed successfully!"
echo ""
echo -e " ${BOLD}Live URL:${NC} $DEPLOY_URL"
echo ""
echo " This URL works on any device — phones, tablets, laptops."
echo " Share it via Slack, email, text, or anywhere."
echo ""
echo -e " ${CYAN}Tip:${NC} To take it down later, visit https://vercel.com/dashboard"
echo -e " and delete the project '${DECK_NAME}'."
echo -e "${BOLD}════════════════════════════════════════${NC}"
echo ""
# ─── Cleanup ──────────────────────────────────────────────
if [[ "$CLEANUP_TEMP" == "true" ]]; then
rm -rf "$DEPLOY_DIR"
fi
#!/usr/bin/env bash
# export-images.sh — Export each slide of an HTML presentation as a separate image
#
# Usage:
# bash scripts/export-images.sh <path-to-html> [output-dir]
#
# Examples:
# bash scripts/export-images.sh ./my-deck/index.html
# bash scripts/export-images.sh ./presentation.html ./out/
# bash scripts/export-images.sh ./presentation.html ./out/ --format jpeg
# bash scripts/export-images.sh ./presentation.html --compact # 1280x720
# bash scripts/export-images.sh ./presentation.html --portrait # 1080x1920 for TikTok / Xiaohongshu
#
# What this does:
# 1. Starts a local server (fonts and relative assets need HTTP)
# 2. Uses Playwright to capture each slide at the chosen viewport
# 3. Saves slide-001.png / slide-002.png / ... into the output directory
#
# Output is per-slide images — perfect for uploading to TikTok, Xiaohongshu,
# Instagram carousels, or anywhere you want each slide as a standalone post.
#
# The images are static snapshots. Animations are captured in their final state.
set -euo pipefail
# ─── Colors ────────────────────────────────────────────────
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m'
info() { echo -e "${CYAN}ℹ${NC} $*"; }
ok() { echo -e "${GREEN}✓${NC} $*"; }
warn() { echo -e "${YELLOW}⚠${NC} $*"; }
err() { echo -e "${RED}✗${NC} $*" >&2; }
# ─── Parse flags ──────────────────────────────────────────
#
# The output resolution is always VIEWPORT_W * DPR by VIEWPORT_H * DPR.
# Setting the viewport below the deck's mobile breakpoint (usually 600px)
# makes the deck's responsive CSS reflow content for the smaller frame —
# so portrait/square modes capture a real vertical layout, not a tiny
# landscape screenshot floating in letterbox bars.
#
# Defaults: 1920x1080 PNG (full HD landscape — slide's native aspect)
# --compact: 1280x720 (HD landscape, smaller files)
# --portrait: 540x960 @ 2x = 1080x1920 (9:16, mobile CSS active)
# --square: 540x540 @ 2x = 1080x1080 (1:1, mobile CSS active)
# --format: png (default) or jpeg
VIEWPORT_W=1920
VIEWPORT_H=1080
DPR=1
FORMAT="png"
MODE="landscape"
POSITIONAL=()
while [[ $# -gt 0 ]]; do
case $1 in
--compact)
VIEWPORT_W=1280
VIEWPORT_H=720
shift
;;
--portrait)
# Render the deck IN a 9:16 phone viewport so responsive CSS
# reflows it for vertical. DPR=2 doubles output to 1080x1920.
VIEWPORT_W=540
VIEWPORT_H=960
DPR=2
MODE="portrait"
shift
;;
--square)
# Same idea but 1:1 — render at 540x540, captured at 1080x1080.
VIEWPORT_W=540
VIEWPORT_H=540
DPR=2
MODE="square"
shift
;;
--format)
FORMAT="${2:-png}"
if [[ "$FORMAT" != "png" && "$FORMAT" != "jpeg" ]]; then
err "--format must be 'png' or 'jpeg' (got: $FORMAT)"
exit 1
fi
shift 2
;;
--format=*)
FORMAT="${1#*=}"
if [[ "$FORMAT" != "png" && "$FORMAT" != "jpeg" ]]; then
err "--format must be 'png' or 'jpeg' (got: $FORMAT)"
exit 1
fi
shift
;;
*)
POSITIONAL+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL[@]}"
# ─── Input validation ─────────────────────────────────────
if [[ $# -lt 1 ]]; then
err "Usage: bash scripts/export-images.sh <path-to-html> [output-dir] [--compact|--portrait|--square] [--format png|jpeg]"
err ""
err "Examples:"
err " bash scripts/export-images.sh ./my-deck/index.html"
err " bash scripts/export-images.sh ./presentation.html ./out/"
err " bash scripts/export-images.sh ./presentation.html --portrait"
err " bash scripts/export-images.sh ./presentation.html --format jpeg"
exit 1
fi
INPUT_HTML="$1"
if [[ ! -f "$INPUT_HTML" ]]; then
err "File not found: $INPUT_HTML"
exit 1
fi
# Resolve to absolute path
INPUT_HTML=$(cd "$(dirname "$INPUT_HTML")" && pwd)/$(basename "$INPUT_HTML")
# Output directory: use second positional arg or derive from input filename
if [[ $# -ge 2 ]]; then
OUTPUT_DIR="$2"
else
DECK_NAME=$(basename "$INPUT_HTML" .html)
OUTPUT_DIR="$(dirname "$INPUT_HTML")/${DECK_NAME}-images"
fi
mkdir -p "$OUTPUT_DIR"
OUTPUT_DIR=$(cd "$OUTPUT_DIR" && pwd)
echo ""
echo -e "${BOLD}╔══════════════════════════════════════╗${NC}"
echo -e "${BOLD}║ Export Slides to Images ║${NC}"
echo -e "${BOLD}╚══════════════════════════════════════╝${NC}"
echo ""
# ─── Step 1: Check dependencies ───────────────────────────
info "Checking dependencies..."
if ! command -v npx &>/dev/null; then
err "Node.js is required but not installed."
err ""
err "Install Node.js:"
err " macOS: brew install node"
err " or visit https://nodejs.org and download the installer"
exit 1
fi
ok "Node.js found"
# ─── Step 2: Build the export script ──────────────────────
TEMP_DIR=$(mktemp -d)
TEMP_SCRIPT="$TEMP_DIR/export-images.mjs"
SERVE_DIR=$(dirname "$INPUT_HTML")
HTML_FILENAME=$(basename "$INPUT_HTML")
cat > "$TEMP_SCRIPT" << 'EXPORT_SCRIPT'
// export-images.mjs — Capture each slide as a standalone image.
//
// 1. Starts a local HTTP server (fonts/assets need HTTP)
// 2. Loads the deck in headless Chromium at the chosen viewport and DPR
// 3. Walks every .slide, forces .reveal animations to their final state
// 4. Screenshots each slide at viewport_w*dpr by viewport_h*dpr pixels
//
// For portrait/square modes the viewport is set narrow enough that the
// deck's responsive CSS reflows for mobile (usually <=600px). DPR=2
// then doubles the output to a retina-sharp 1080-wide image.
import { chromium } from 'playwright';
import { createServer } from 'http';
import { readFileSync, mkdirSync } from 'fs';
import { join, extname } from 'path';
const SERVE_DIR = process.argv[2];
const HTML_FILE = process.argv[3];
const OUT_DIR = process.argv[4];
const VP_W = parseInt(process.argv[5]) || 1920;
const VP_H = parseInt(process.argv[6]) || 1080;
const DPR = parseFloat(process.argv[7]) || 1;
const FORMAT = (process.argv[8] || 'png').toLowerCase();
// ─── Static file server ───────────────────────────────────
const MIME_TYPES = {
'.html': 'text/html', '.css': 'text/css', '.js': 'application/javascript',
'.json': 'application/json',
'.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg',
'.gif': 'image/gif', '.svg': 'image/svg+xml', '.webp': 'image/webp',
'.woff': 'font/woff', '.woff2': 'font/woff2', '.ttf': 'font/ttf',
};
const server = createServer((req, res) => {
const decodedUrl = decodeURIComponent(req.url);
const filePath = join(SERVE_DIR, decodedUrl === '/' ? HTML_FILE : decodedUrl);
try {
const content = readFileSync(filePath);
const ext = extname(filePath).toLowerCase();
res.writeHead(200, { 'Content-Type': MIME_TYPES[ext] || 'application/octet-stream' });
res.end(content);
} catch {
res.writeHead(404);
res.end('Not found');
}
});
const port = await new Promise((resolve) => {
server.listen(0, () => resolve(server.address().port));
});
console.log(` Local server on port ${port}`);
// ─── Open deck + count slides ─────────────────────────────
const browser = await chromium.launch();
const page = await browser.newPage({
viewport: { width: VP_W, height: VP_H },
deviceScaleFactor: DPR,
});
await page.goto(`http://localhost:${port}/`, { waitUntil: 'networkidle' });
await page.evaluate(() => document.fonts.ready);
await page.waitForTimeout(1500);
const slideCount = await page.evaluate(() => document.querySelectorAll('.slide').length);
console.log(` Found ${slideCount} slides`);
if (slideCount === 0) {
console.error(' ERROR: No .slide elements found.');
console.error(' Make sure your HTML uses <section class="slide"> or <div class="slide">.');
await browser.close(); server.close(); process.exit(1);
}
mkdirSync(OUT_DIR, { recursive: true });
// ─── Capture each slide ───────────────────────────────────
const rawPaths = [];
const ext = FORMAT === 'jpeg' ? 'jpg' : 'png';
// Mark every slide as .visible upfront so .reveal transitions don't
// leave delayed-staggered items invisible at screenshot time. Force
// each .reveal element's inline styles to their final state too —
// belt + suspenders against any preset that uses different selectors.
await page.evaluate(() => {
document.querySelectorAll('.slide').forEach(s => s.classList.add('visible'));
document.querySelectorAll('.reveal').forEach(el => {
el.style.opacity = '1';
el.style.transform = 'none';
el.style.visibility = 'visible';
el.style.filter = 'none';
});
});
// Let layout settle after the bulk style change.
await page.waitForTimeout(400);
for (let i = 0; i < slideCount; i++) {
// Scroll the target slide into view. Scroll-snap will lock it to
// the top of the viewport. We don't hide siblings — that breaks
// layout in decks that size grids relative to ancestor heights.
await page.evaluate((index) => {
const slides = document.querySelectorAll('.slide');
slides[index]?.scrollIntoView({ behavior: 'instant', block: 'start' });
slides.forEach((s, idx) => s.classList.toggle('active', idx === index));
if (window.presentation && typeof window.presentation.goToSlide === 'function') {
window.presentation.goToSlide(index);
}
}, i);
// Wait for scroll/snap to complete.
await page.waitForTimeout(250);
const filename = `slide-${String(i + 1).padStart(3, '0')}.${ext}`;
const outPath = join(OUT_DIR, filename);
const shotOpts = {
path: outPath,
fullPage: false,
type: FORMAT,
};
if (FORMAT === 'jpeg') shotOpts.quality = 92;
await page.screenshot(shotOpts);
rawPaths.push(outPath);
console.log(` Captured ${filename}`);
}
await browser.close();
server.close();
console.log(` ✓ ${rawPaths.length} image(s) written to: ${OUT_DIR}`);
EXPORT_SCRIPT
# ─── Step 3: Install Playwright in temp dir ───────────────
info "Setting up Playwright (headless browser for screenshots)..."
info "This may take a moment on first run..."
echo ""
cd "$TEMP_DIR"
cat > "$TEMP_DIR/package.json" << 'PKG'
{ "name": "slide-export", "private": true, "type": "module" }
PKG
npm install playwright &>/dev/null || {
err "Failed to install Playwright."
err "Try running: npm install playwright"
rm -rf "$TEMP_DIR"
exit 1
}
npx playwright install chromium 2>/dev/null || {
err "Failed to install Chromium browser for Playwright."
err "Try running manually: npx playwright install chromium"
rm -rf "$TEMP_DIR"
exit 1
}
ok "Playwright ready"
echo ""
# ─── Step 4: Run the export ───────────────────────────────
OUTPUT_W=$((VIEWPORT_W * DPR))
OUTPUT_H=$((VIEWPORT_H * DPR))
if [[ "$MODE" == "portrait" ]]; then
info "Mode: portrait — viewport ${VIEWPORT_W}x${VIEWPORT_H} @ ${DPR}x = ${OUTPUT_W}x${OUTPUT_H} ${FORMAT}"
info " (deck's responsive CSS reflows for mobile viewport)"
elif [[ "$MODE" == "square" ]]; then
info "Mode: square — viewport ${VIEWPORT_W}x${VIEWPORT_H} @ ${DPR}x = ${OUTPUT_W}x${OUTPUT_H} ${FORMAT}"
info " (deck's responsive CSS reflows for mobile viewport)"
else
info "Mode: landscape — ${OUTPUT_W}x${OUTPUT_H} ${FORMAT}"
fi
info "Exporting..."
echo ""
node "$TEMP_SCRIPT" "$SERVE_DIR" "$HTML_FILENAME" "$OUTPUT_DIR" "$VIEWPORT_W" "$VIEWPORT_H" "$DPR" "$FORMAT" || {
err "Image export failed."
rm -rf "$TEMP_DIR"
exit 1
}
# ─── Step 5: Cleanup and success ──────────────────────────
rm -rf "$TEMP_DIR"
# Count actual output files
IMAGE_COUNT=$(find "$OUTPUT_DIR" -maxdepth 1 -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) | wc -l | xargs)
TOTAL_SIZE=$(du -sh "$OUTPUT_DIR" 2>/dev/null | cut -f1 | xargs)
echo ""
echo -e "${BOLD}════════════════════════════════════════${NC}"
ok "Images exported successfully!"
echo ""
echo -e " ${BOLD}Folder:${NC} $OUTPUT_DIR"
echo -e " ${BOLD}Files:${NC} $IMAGE_COUNT image(s)"
echo -e " ${BOLD}Size:${NC} $TOTAL_SIZE"
echo ""
case "$MODE" in
portrait)
echo " Ready for TikTok, Reels, Xiaohongshu vertical posts."
;;
square)
echo " Ready for Instagram square posts, Xiaohongshu 1:1 carousels."
;;
*)
echo " Ready for blog headers, carousel posts, slide previews."
echo " Use --portrait for 9:16 (TikTok / Reels) or --square for 1:1 (IG / RedNote)."
;;
esac
echo -e "${BOLD}════════════════════════════════════════${NC}"
echo ""
# Open the output folder so the user can immediately see the results
if command -v open &>/dev/null; then
open "$OUTPUT_DIR"
elif command -v xdg-open &>/dev/null; then
xdg-open "$OUTPUT_DIR"
fi
#!/usr/bin/env bash
# export-pdf.sh — Export an HTML presentation to PDF
#
# Usage:
# bash scripts/export-pdf.sh <path-to-html> [output.pdf]
#
# Examples:
# bash scripts/export-pdf.sh ./my-deck/index.html
# bash scripts/export-pdf.sh ./presentation.html ./presentation.pdf
#
# What this does:
# 1. Starts a local server to serve the HTML (fonts and assets need HTTP)
# 2. Uses Playwright to screenshot each slide at 1920x1080
# 3. Combines all screenshots into a single PDF
# 4. Cleans up the server and temp files
#
# The PDF preserves colors, fonts, and layout — but not animations.
# Perfect for email attachments, printing, or embedding in documents.
set -euo pipefail
# ─── Colors ────────────────────────────────────────────────
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m'
info() { echo -e "${CYAN}ℹ${NC} $*"; }
ok() { echo -e "${GREEN}✓${NC} $*"; }
warn() { echo -e "${YELLOW}⚠${NC} $*"; }
err() { echo -e "${RED}✗${NC} $*" >&2; }
# ─── Parse flags ──────────────────────────────────────────
# Default resolution: 1920x1080 (full HD, ~1-2MB per slide)
# Compact resolution: 1280x720 (HD, ~50-70% smaller files)
VIEWPORT_W=1920
VIEWPORT_H=1080
COMPACT=false
POSITIONAL=()
for arg in "$@"; do
case $arg in
--compact)
COMPACT=true
VIEWPORT_W=1280
VIEWPORT_H=720
;;
*)
POSITIONAL+=("$arg")
;;
esac
done
set -- "${POSITIONAL[@]}"
# ─── Input validation ─────────────────────────────────────
if [[ $# -lt 1 ]]; then
err "Usage: bash scripts/export-pdf.sh <path-to-html> [output.pdf] [--compact]"
err ""
err "Examples:"
err " bash scripts/export-pdf.sh ./my-deck/index.html"
err " bash scripts/export-pdf.sh ./presentation.html ./slides.pdf"
err " bash scripts/export-pdf.sh ./presentation.html --compact # smaller file size"
exit 1
fi
INPUT_HTML="$1"
if [[ ! -f "$INPUT_HTML" ]]; then
err "File not found: $INPUT_HTML"
exit 1
fi
# Resolve to absolute path
INPUT_HTML=$(cd "$(dirname "$INPUT_HTML")" && pwd)/$(basename "$INPUT_HTML")
# Output PDF path: use second argument or derive from input name
if [[ $# -ge 2 ]]; then
OUTPUT_PDF="$2"
else
OUTPUT_PDF="$(dirname "$INPUT_HTML")/$(basename "$INPUT_HTML" .html).pdf"
fi
# Resolve output to absolute path
OUTPUT_DIR=$(dirname "$OUTPUT_PDF")
mkdir -p "$OUTPUT_DIR"
OUTPUT_PDF="$OUTPUT_DIR/$(basename "$OUTPUT_PDF")"
echo ""
echo -e "${BOLD}╔══════════════════════════════════════╗${NC}"
echo -e "${BOLD}║ Export Slides to PDF ║${NC}"
echo -e "${BOLD}╚══════════════════════════════════════╝${NC}"
echo ""
# ─── Step 1: Check dependencies ───────────────────────────
info "Checking dependencies..."
if ! command -v npx &>/dev/null; then
err "Node.js is required but not installed."
err ""
err "Install Node.js:"
err " macOS: brew install node"
err " or visit https://nodejs.org and download the installer"
exit 1
fi
ok "Node.js found"
# ─── Step 2: Create the export script ─────────────────────
# We use a temporary Node.js script with Playwright to:
# 1. Start a local server (so fonts load correctly)
# 2. Navigate to each slide
# 3. Screenshot each slide at 1920x1080 (16:9 landscape)
# 4. Combine into a single PDF
TEMP_DIR=$(mktemp -d)
TEMP_SCRIPT="$TEMP_DIR/export-slides.mjs"
# Figure out which directory to serve (the folder containing the HTML)
SERVE_DIR=$(dirname "$INPUT_HTML")
HTML_FILENAME=$(basename "$INPUT_HTML")
cat > "$TEMP_SCRIPT" << 'EXPORT_SCRIPT'
// export-slides.mjs — Playwright script to export HTML slides to PDF
//
// How it works:
// 1. Starts a local HTTP server (needed for fonts/assets to load)
// 2. Opens the presentation in a headless browser at 1920x1080
// 3. Counts the total number of slides
// 4. Screenshots each slide one by one
// 5. Generates a PDF with all slides as landscape pages
import { chromium } from 'playwright';
import { createServer } from 'http';
import { readFileSync, existsSync, mkdirSync, unlinkSync, writeFileSync } from 'fs';
import { join, extname, resolve } from 'path';
import { execSync } from 'child_process';
const SERVE_DIR = process.argv[2];
const HTML_FILE = process.argv[3];
const OUTPUT_PDF = process.argv[4];
const SCREENSHOT_DIR = process.argv[5];
const VP_WIDTH = parseInt(process.argv[6]) || 1920;
const VP_HEIGHT = parseInt(process.argv[7]) || 1080;
// ─── Simple static file server ────────────────────────────
// (We need HTTP so that Google Fonts and relative assets load correctly)
const MIME_TYPES = {
'.html': 'text/html',
'.css': 'text/css',
'.js': 'application/javascript',
'.json': 'application/json',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.gif': 'image/gif',
'.svg': 'image/svg+xml',
'.webp': 'image/webp',
'.woff': 'font/woff',
'.woff2': 'font/woff2',
'.ttf': 'font/ttf',
'.eot': 'application/vnd.ms-fontobject',
};
const server = createServer((req, res) => {
// Decode URL-encoded characters (e.g., %20 → space) so filenames with spaces resolve correctly
const decodedUrl = decodeURIComponent(req.url);
let filePath = join(SERVE_DIR, decodedUrl === '/' ? HTML_FILE : decodedUrl);
try {
const content = readFileSync(filePath);
const ext = extname(filePath).toLowerCase();
res.writeHead(200, { 'Content-Type': MIME_TYPES[ext] || 'application/octet-stream' });
res.end(content);
} catch {
res.writeHead(404);
res.end('Not found');
}
});
// Find a free port
const port = await new Promise((resolve) => {
server.listen(0, () => resolve(server.address().port));
});
console.log(` Local server on port ${port}`);
// ─── Screenshot each slide ────────────────────────────────
const browser = await chromium.launch();
const page = await browser.newPage({
viewport: { width: VP_WIDTH, height: VP_HEIGHT },
});
// Load the presentation
await page.goto(`http://localhost:${port}/`, { waitUntil: 'networkidle' });
// Wait for fonts to load
await page.evaluate(() => document.fonts.ready);
// Extra wait for animations to settle on the first slide
await page.waitForTimeout(1500);
// Count slides
const slideCount = await page.evaluate(() => {
return document.querySelectorAll('.slide').length;
});
console.log(` Found ${slideCount} slides`);
if (slideCount === 0) {
console.error(' ERROR: No .slide elements found in the presentation.');
console.error(' Make sure your HTML uses <div class="slide"> or <section class="slide">.');
await browser.close();
server.close();
process.exit(1);
}
// Screenshot each slide
mkdirSync(SCREENSHOT_DIR, { recursive: true });
const screenshotPaths = [];
for (let i = 0; i < slideCount; i++) {
// Navigate to slide by simulating the presentation's navigation
// Most frontend-slides presentations use a currentSlide index and show/hide
await page.evaluate((index) => {
const slides = document.querySelectorAll('.slide');
// Try multiple navigation strategies used by frontend-slides:
// Strategy 1: Direct slide manipulation (most common in generated decks)
slides.forEach((slide, idx) => {
if (idx === index) {
slide.style.display = '';
slide.style.opacity = '1';
slide.style.visibility = 'visible';
slide.style.position = 'relative';
slide.style.transform = 'none';
slide.classList.add('active');
} else {
slide.style.display = 'none';
slide.classList.remove('active');
}
});
// Strategy 2: If there's a SlidePresentation class instance, use it
if (window.presentation && typeof window.presentation.goToSlide === 'function') {
window.presentation.goToSlide(index);
}
// Strategy 3: Scroll-based (some decks use scroll snapping)
slides[index]?.scrollIntoView({ behavior: 'instant' });
}, i);
// Wait for any slide transition animations to finish
await page.waitForTimeout(300);
// Wait for intersection observer animations to trigger
await page.waitForTimeout(200);
// Force all .reveal elements on the current slide to be visible
// (animations normally trigger on scroll/intersection, but we need them visible now)
await page.evaluate((index) => {
const slides = document.querySelectorAll('.slide');
const currentSlide = slides[index];
if (currentSlide) {
currentSlide.querySelectorAll('.reveal').forEach(el => {
el.style.opacity = '1';
el.style.transform = 'none';
el.style.visibility = 'visible';
});
}
}, i);
await page.waitForTimeout(100);
const screenshotPath = join(SCREENSHOT_DIR, `slide-${String(i + 1).padStart(3, '0')}.png`);
await page.screenshot({ path: screenshotPath, fullPage: false });
screenshotPaths.push(screenshotPath);
console.log(` Captured slide ${i + 1}/${slideCount}`);
}
await browser.close();
server.close();
// ─── Combine screenshots into PDF ─────────────────────────
// Use a second Playwright page to generate a PDF from the screenshots
console.log(' Assembling PDF...');
const browser2 = await chromium.launch();
const pdfPage = await browser2.newPage();
// Build an HTML page with all screenshots, one per page
const imagesHtml = screenshotPaths.map((p) => {
const imgData = readFileSync(p).toString('base64');
return `<div class="page"><img src="data:image/png;base64,${imgData}" /></div>`;
}).join('\n');
const pdfHtml = `<!DOCTYPE html>
<html>
<head>
<style>
* { margin: 0; padding: 0; }
@page { size: ${VP_WIDTH}px ${VP_HEIGHT}px; margin: 0; }
.page {
width: ${VP_WIDTH}px;
height: ${VP_HEIGHT}px;
page-break-after: always;
overflow: hidden;
}
.page:last-child { page-break-after: auto; }
img {
width: ${VP_WIDTH}px;
height: ${VP_HEIGHT}px;
display: block;
object-fit: contain;
}
</style>
</head>
<body>${imagesHtml}</body>
</html>`;
await pdfPage.setContent(pdfHtml, { waitUntil: 'load' });
await pdfPage.pdf({
path: OUTPUT_PDF,
width: `${VP_WIDTH}px`,
height: `${VP_HEIGHT}px`,
printBackground: true,
margin: { top: 0, right: 0, bottom: 0, left: 0 },
});
await browser2.close();
// Clean up screenshots
screenshotPaths.forEach(p => unlinkSync(p));
console.log(` ✓ PDF saved to: ${OUTPUT_PDF}`);
EXPORT_SCRIPT
# ─── Step 3: Install Playwright in temp directory ──────────
# We install Playwright locally in the temp dir so the Node script can import it.
# This avoids polluting global packages and ensures the script is self-contained.
info "Setting up Playwright (headless browser for screenshots)..."
info "This may take a moment on first run..."
echo ""
cd "$TEMP_DIR"
# Create a minimal package.json so npm install works
cat > "$TEMP_DIR/package.json" << 'PKG'
{ "name": "slide-export", "private": true, "type": "module" }
PKG
# Install Playwright into the temp directory
npm install playwright &>/dev/null || {
err "Failed to install Playwright."
err "Try running: npm install playwright"
rm -rf "$TEMP_DIR"
exit 1
}
# Ensure Chromium browser binary is downloaded
npx playwright install chromium 2>/dev/null || {
err "Failed to install Chromium browser for Playwright."
err "Try running manually: npx playwright install chromium"
rm -rf "$TEMP_DIR"
exit 1
}
ok "Playwright ready"
echo ""
# ─── Step 4: Run the export ───────────────────────────────
SCREENSHOT_DIR="$TEMP_DIR/screenshots"
info "Exporting slides to PDF..."
echo ""
# Run from the temp dir so Node can find the locally-installed playwright
if [[ "$COMPACT" == "true" ]]; then
info "Using compact mode (1280×720) for smaller file size"
fi
node "$TEMP_SCRIPT" "$SERVE_DIR" "$HTML_FILENAME" "$OUTPUT_PDF" "$SCREENSHOT_DIR" "$VIEWPORT_W" "$VIEWPORT_H" || {
err "PDF export failed."
rm -rf "$TEMP_DIR"
exit 1
}
# ─── Step 5: Cleanup and success ──────────────────────────
rm -rf "$TEMP_DIR"
echo ""
echo -e "${BOLD}════════════════════════════════════════${NC}"
ok "PDF exported successfully!"
echo ""
echo -e " ${BOLD}File:${NC} $OUTPUT_PDF"
echo ""
FILE_SIZE=$(du -h "$OUTPUT_PDF" | cut -f1 | xargs)
echo " Size: $FILE_SIZE"
echo ""
echo " This PDF works everywhere — email, Slack, Notion, print."
echo " Note: Animations are not preserved (it's a static export)."
echo -e "${BOLD}════════════════════════════════════════${NC}"
echo ""
# Open the PDF automatically
if command -v open &>/dev/null; then
open "$OUTPUT_PDF"
elif command -v xdg-open &>/dev/null; then
xdg-open "$OUTPUT_PDF"
fi
#!/usr/bin/env python3
"""
Extract all content from a PowerPoint file (.pptx).
Returns a JSON structure with slides, text, and images.
Usage:
python extract-pptx.py <input.pptx> [output_dir]
Requires: pip install python-pptx
"""
import json
import os
import sys
from pptx import Presentation
def extract_pptx(file_path, output_dir="."):
"""
Extract all content from a PowerPoint file.
Returns a list of slide data dicts with text, images, and notes.
"""
prs = Presentation(file_path)
slides_data = []
# Create assets directory for extracted images
assets_dir = os.path.join(output_dir, "assets")
os.makedirs(assets_dir, exist_ok=True)
for slide_num, slide in enumerate(prs.slides):
slide_data = {
"number": slide_num + 1,
"title": "",
"content": [],
"images": [],
"notes": "",
}
for shape in slide.shapes:
# Extract text content
if shape.has_text_frame:
if shape == slide.shapes.title:
slide_data["title"] = shape.text
else:
slide_data["content"].append(
{"type": "text", "content": shape.text}
)
# Extract images
if shape.shape_type == 13: # Picture type
image = shape.image
image_bytes = image.blob
image_ext = image.ext
image_name = f"slide{slide_num + 1}_img{len(slide_data['images']) + 1}.{image_ext}"
image_path = os.path.join(assets_dir, image_name)
with open(image_path, "wb") as f:
f.write(image_bytes)
slide_data["images"].append(
{
"path": f"assets/{image_name}",
"width": shape.width,
"height": shape.height,
}
)
# Extract speaker notes
if slide.has_notes_slide:
notes_frame = slide.notes_slide.notes_text_frame
slide_data["notes"] = notes_frame.text
slides_data.append(slide_data)
return slides_data
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python extract-pptx.py <input.pptx> [output_dir]")
sys.exit(1)
input_file = sys.argv[1]
output_dir = sys.argv[2] if len(sys.argv) > 2 else "."
slides = extract_pptx(input_file, output_dir)
# Write extracted data as JSON
output_path = os.path.join(output_dir, "extracted-slides.json")
with open(output_path, "w") as f:
json.dump(slides, f, indent=2)
print(f"Extracted {len(slides)} slides to {output_path}")
for s in slides:
img_count = len(s["images"])
print(f" Slide {s['number']}: {s['title'] or '(no title)'} — {img_count} image(s)")
Style Presets Reference
Curated visual styles for Frontend Slides. Each preset is inspired by real design references — no generic "AI slop" aesthetics. Abstract shapes only — no illustrations.
Viewport CSS: For mandatory base styles, see viewport-base.css. Include in every presentation.
---
Dark Themes
1. Bold Signal
Vibe: Confident, bold, modern, high-impact
Layout: Colored card on dark gradient. Number top-left, navigation top-right, title bottom-left.
Typography:
- Display:
Archivo Black(900) - Body:
Space Grotesk(400/500)
Colors:
:root {
--bg-primary: #1a1a1a;
--bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
--card-bg: #FF5722;
--text-primary: #ffffff;
--text-on-card: #1a1a1a;
}Signature Elements:
- Bold colored card as focal point (orange, coral, or vibrant accent)
- Large section numbers (01, 02, etc.)
- Navigation breadcrumbs with active/inactive opacity states
- Grid-based layout for precise alignment
---
2. Electric Studio
Vibe: Bold, clean, professional, high contrast
Layout: Split panel—white top, blue bottom. Brand marks in corners.
Typography:
- Display:
Manrope(800) - Body:
Manrope(400/500)
Colors:
:root {
--bg-dark: #0a0a0a;
--bg-white: #ffffff;
--accent-blue: #4361ee;
--text-dark: #0a0a0a;
--text-light: #ffffff;
}Signature Elements:
- Two-panel vertical split
- Accent bar on panel edge
- Quote typography as hero element
- Minimal, confident spacing
---
3. Creative Voltage
Vibe: Bold, creative, energetic, retro-modern
Layout: Split panels—electric blue left, dark right. Script accents.
Typography:
- Display:
Syne(700/800) - Mono:
Space Mono(400/700)
Colors:
:root {
--bg-primary: #0066ff;
--bg-dark: #1a1a2e;
--accent-neon: #d4ff00;
--text-light: #ffffff;
}Signature Elements:
- Electric blue + neon yellow contrast
- Halftone texture patterns
- Neon badges/callouts
- Script typography for creative flair
---
4. Dark Botanical
Vibe: Elegant, sophisticated, artistic, premium
Layout: Centered content on dark. Abstract soft shapes in corner.
Typography:
- Display:
Cormorant(400/600) — elegant serif - Body:
IBM Plex Sans(300/400)
Colors:
:root {
--bg-primary: #0f0f0f;
--text-primary: #e8e4df;
--text-secondary: #9a9590;
--accent-warm: #d4a574;
--accent-pink: #e8b4b8;
--accent-gold: #c9b896;
}Signature Elements:
- Abstract soft gradient circles (blurred, overlapping)
- Warm color accents (pink, gold, terracotta)
- Thin vertical accent lines
- Italic signature typography
- No illustrations—only abstract CSS shapes
---
Light Themes
5. Notebook Tabs
Vibe: Editorial, organized, elegant, tactile
Layout: Cream paper card on dark background. Colorful tabs on right edge.
Typography:
- Display:
Bodoni Moda(400/700) — classic editorial - Body:
DM Sans(400/500)
Colors:
:root {
--bg-outer: #2d2d2d;
--bg-page: #f8f6f1;
--text-primary: #1a1a1a;
--tab-1: #98d4bb; /* Mint */
--tab-2: #c7b8ea; /* Lavender */
--tab-3: #f4b8c5; /* Pink */
--tab-4: #a8d8ea; /* Sky */
--tab-5: #ffe6a7; /* Cream */
}Signature Elements:
- Paper container with subtle shadow
- Colorful section tabs on right edge (vertical text)
- Binder hole decorations on left
- Tab text must scale with viewport:
font-size: clamp(0.5rem, 1vh, 0.7rem)
---
6. Pastel Geometry
Vibe: Friendly, organized, modern, approachable
Layout: White card on pastel background. Vertical pills on right edge.
Typography:
- Display:
Plus Jakarta Sans(700/800) - Body:
Plus Jakarta Sans(400/500)
Colors:
:root {
--bg-primary: #c8d9e6;
--card-bg: #faf9f7;
--pill-pink: #f0b4d4;
--pill-mint: #a8d4c4;
--pill-sage: #5a7c6a;
--pill-lavender: #9b8dc4;
--pill-violet: #7c6aad;
}Signature Elements:
- Rounded card with soft shadow
- Vertical pills on right edge with varying heights (like tabs)
- Consistent pill width, heights: short → medium → tall → medium → short
- Download/action icon in corner
---
7. Split Pastel
Vibe: Playful, modern, friendly, creative
Layout: Two-color vertical split (peach left, lavender right).
Typography:
- Display:
Outfit(700/800) - Body:
Outfit(400/500)
Colors:
:root {
--bg-peach: #f5e6dc;
--bg-lavender: #e4dff0;
--text-dark: #1a1a1a;
--badge-mint: #c8f0d8;
--badge-yellow: #f0f0c8;
--badge-pink: #f0d4e0;
}Signature Elements:
- Split background colors
- Playful badge pills with icons
- Grid pattern overlay on right panel
- Rounded CTA buttons
---
8. Vintage Editorial
Vibe: Witty, confident, editorial, personality-driven
Layout: Centered content on cream. Abstract geometric shapes as accent.
Typography:
- Display:
Fraunces(700/900) — distinctive serif - Body:
Work Sans(400/500)
Colors:
:root {
--bg-cream: #f5f3ee;
--text-primary: #1a1a1a;
--text-secondary: #555;
--accent-warm: #e8d4c0;
}Signature Elements:
- Abstract geometric shapes (circle outline + line + dot)
- Bold bordered CTA boxes
- Witty, conversational copy style
- No illustrations—only geometric CSS shapes
---
Specialty Themes
9. Neon Cyber
Vibe: Futuristic, techy, confident
Typography: Clash Display + Satoshi (Fontshare)
Colors: Deep navy (#0a0f1c), cyan accent (#00ffcc), magenta (#ff00aa)
Signature: Particle backgrounds, neon glow, grid patterns
---
10. Terminal Green
Vibe: Developer-focused, hacker aesthetic
Typography: JetBrains Mono (monospace only)
Colors: GitHub dark (#0d1117), terminal green (#39d353)
Signature: Scan lines, blinking cursor, code syntax styling
---
11. Swiss Modern
Vibe: Clean, precise, Bauhaus-inspired
Typography: Archivo (800) + Nunito (400)
Colors: Pure white, pure black, red accent (#ff3300)
Signature: Visible grid, asymmetric layouts, geometric shapes
---
12. Paper & Ink
Vibe: Editorial, literary, thoughtful
Typography: Cormorant Garamond + Source Serif 4
Colors: Warm cream (#faf9f7), charcoal (#1a1a1a), crimson accent (#c41e3a)
Signature: Drop caps, pull quotes, elegant horizontal rules
---
Font Pairing Quick Reference
| Preset | Display Font | Body Font | Source |
|---|---|---|---|
| Bold Signal | Archivo Black | Space Grotesk | |
| Electric Studio | Manrope | Manrope | |
| Creative Voltage | Syne | Space Mono | |
| Dark Botanical | Cormorant | IBM Plex Sans | |
| Notebook Tabs | Bodoni Moda | DM Sans | |
| Pastel Geometry | Plus Jakarta Sans | Plus Jakarta Sans | |
| Split Pastel | Outfit | Outfit | |
| Vintage Editorial | Fraunces | Work Sans | |
| Neon Cyber | Clash Display | Satoshi | Fontshare |
| Terminal Green | JetBrains Mono | JetBrains Mono | JetBrains |
---
DO NOT USE (Generic AI Patterns)
Fonts: Inter, Roboto, Arial, system fonts as display
Colors: #6366f1 (generic indigo), purple gradients on white
Layouts: Everything centered, generic hero sections, identical card grids
Decorations: Realistic illustrations, gratuitous glassmorphism, drop shadows without purpose
---
CSS Gotchas
Negating CSS Functions
WRONG — silently ignored by browsers (no console error):
right: -clamp(28px, 3.5vw, 44px); /* Browser ignores this */
margin-left: -min(10vw, 100px); /* Browser ignores this */CORRECT — wrap in `calc()`:
right: calc(-1 * clamp(28px, 3.5vw, 44px)); /* Works */
margin-left: calc(-1 * min(10vw, 100px)); /* Works */CSS does not allow a leading - before function names. The browser silently discards the entire declaration — no error, the element just appears in the wrong position. *Always use `calc(-1 ...)` to negate CSS function values.**
/* ===========================================
VIEWPORT FITTING: MANDATORY BASE STYLES
Include this ENTIRE file in every presentation.
These styles ensure slides fit exactly in the viewport.
=========================================== */
/* 1. Lock html/body to viewport */
html, body {
height: 100%;
overflow-x: hidden;
}
html {
scroll-snap-type: y mandatory;
scroll-behavior: smooth;
}
/* 2. Each slide = exact viewport height */
.slide {
width: 100vw;
height: 100vh;
height: 100dvh; /* Dynamic viewport height for mobile browsers */
overflow: hidden; /* CRITICAL: Prevent ANY overflow */
scroll-snap-align: start;
display: flex;
flex-direction: column;
position: relative;
}
/* 3. Content container with flex for centering */
.slide-content {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
max-height: 100%;
overflow: hidden; /* Double-protection against overflow */
padding: var(--slide-padding);
}
/* 4. ALL typography uses clamp() for responsive scaling */
:root {
/* Titles scale from mobile to desktop */
--title-size: clamp(1.5rem, 5vw, 4rem);
--h2-size: clamp(1.25rem, 3.5vw, 2.5rem);
--h3-size: clamp(1rem, 2.5vw, 1.75rem);
/* Body text */
--body-size: clamp(0.75rem, 1.5vw, 1.125rem);
--small-size: clamp(0.65rem, 1vw, 0.875rem);
/* Spacing scales with viewport */
--slide-padding: clamp(1rem, 4vw, 4rem);
--content-gap: clamp(0.5rem, 2vw, 2rem);
--element-gap: clamp(0.25rem, 1vw, 1rem);
}
/* 5. Cards/containers use viewport-relative max sizes */
.card, .container, .content-box {
max-width: min(90vw, 1000px);
max-height: min(80vh, 700px);
}
/* 6. Lists auto-scale with viewport */
.feature-list, .bullet-list {
gap: clamp(0.4rem, 1vh, 1rem);
}
.feature-list li, .bullet-list li {
font-size: var(--body-size);
line-height: 1.4;
}
/* 7. Grids adapt to available space */
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
gap: clamp(0.5rem, 1.5vw, 1rem);
}
/* 8. Images constrained to viewport */
img, .image-container {
max-width: 100%;
max-height: min(50vh, 400px);
object-fit: contain;
}
/* ===========================================
RESPONSIVE BREAKPOINTS
Aggressive scaling for smaller viewports
=========================================== */
/* Short viewports (< 700px height) */
@media (max-height: 700px) {
:root {
--slide-padding: clamp(0.75rem, 3vw, 2rem);
--content-gap: clamp(0.4rem, 1.5vw, 1rem);
--title-size: clamp(1.25rem, 4.5vw, 2.5rem);
--h2-size: clamp(1rem, 3vw, 1.75rem);
}
}
/* Very short viewports (< 600px height) */
@media (max-height: 600px) {
:root {
--slide-padding: clamp(0.5rem, 2.5vw, 1.5rem);
--content-gap: clamp(0.3rem, 1vw, 0.75rem);
--title-size: clamp(1.1rem, 4vw, 2rem);
--body-size: clamp(0.7rem, 1.2vw, 0.95rem);
}
/* Hide non-essential elements.
!important needed because preset CSS is inlined after
this file and would otherwise win on equal specificity. */
.nav-dots, .keyboard-hint, .decorative {
display: none !important;
}
}
/* Extremely short (landscape phones, < 500px height) */
@media (max-height: 500px) {
:root {
--slide-padding: clamp(0.4rem, 2vw, 1rem);
--title-size: clamp(1rem, 3.5vw, 1.5rem);
--h2-size: clamp(0.9rem, 2.5vw, 1.25rem);
--body-size: clamp(0.65rem, 1vw, 0.85rem);
}
}
/* Narrow viewports (< 600px width) */
@media (max-width: 600px) {
:root {
--title-size: clamp(1.25rem, 7vw, 2.5rem);
}
/* Stack grids vertically */
.grid {
grid-template-columns: 1fr;
}
}
/* ===========================================
MOBILE PATTERNS
Touch-friendly defaults for phones / narrow viewports.
Uses !important because preset CSS is inlined AFTER this
file and would otherwise win on equal specificity.
=========================================== */
/* Long URLs, file paths, and code lines must wrap so they
don't blow out the slide horizontally on phones. */
@media (max-width: 600px) {
pre, code,
.code-block, .code-block .line,
.terminal, .term {
overflow-wrap: anywhere !important;
word-break: break-word;
}
}
/* Nav dots: vertical right-rail on desktop becomes a
horizontal bottom-bar pill on phones. This is more
ergonomic for one-handed swiping and stops the rail
from overlapping content at narrow widths. */
@media (max-width: 600px) {
.nav-dots {
position: fixed !important;
left: 50% !important;
right: auto !important;
top: auto !important;
bottom: clamp(0.6rem, 2vh, 1.2rem) !important;
transform: translateX(-50%) !important;
flex-direction: row !important;
gap: clamp(0.35rem, 1.5vw, 0.6rem) !important;
padding: clamp(0.35rem, 1vh, 0.55rem) clamp(0.6rem, 2vw, 0.9rem) !important;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
border-radius: 999px !important;
z-index: 90;
}
}
/* Common density-heavy layout classes collapse to one
column on phones. Decks that use these conventional
class names get mobile-stacking for free.
`grid-template-rows: auto` resets any explicit row
definitions (e.g. `repeat(2, 1fr)` on a 2x2 grid) so
stacked items size to their content instead of being
squeezed into the original row count. */
@media (max-width: 600px) {
.two-col,
.compare,
.side-by-side,
.cards-2x2,
.cards-grid {
grid-template-columns: 1fr !important;
grid-template-rows: auto !important;
}
}
/* Very short viewports already hide nav-dots via the
max-height: 600 rule above; that takes precedence
over this bottom-bar layout — landscape-phones stay
un-cluttered. */
/* ===========================================
REDUCED MOTION
Respect user preferences
=========================================== */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.2s !important;
}
html {
scroll-behavior: auto;
}
}