PortaPack bundles your entire website — HTML, CSS, JS, images, and fonts — into one self-contained HTML file. Perfect for snapshots, demos, testing, and offline apps.
Minimal input. Maximal output.
- 📖 Getting Started
- ⚙️ CLI Reference
- 🛠 Configuration Guide
- 💻 API Reference
- 🏛️ Architecture
- 🚧 Roadmap
- 🤝 Contributing Guidelines
# Global CLI (recommended)
npm install -g portapack
# OR use npx (no install needed)
npx portapack ./index.html -o bundle.html
# Basic
portapack ./index.html
portapack https://example.com
# With output path
portapack ./page.html -o dist/output.html
# Full recursive bundle
portapack https://example.com --recursive 2 -o full.html
# Dev mode (no minify, verbose)
portapack ./src/index.html --no-minify -v
# Production mode (optimized)
portapack ./src/index.html -m -o dist/prod.html
# Dry run preview
portapack ./index.html --dry-run
PortaPack is fully usable via code.
import { pack } from 'portapack';
const result = await pack('./index.html'); // local or URL
console.log(result.html); // bundled HTML
import { pack, LogLevel } from 'portapack';
import fs from 'fs';
const result = await pack('https://example.com', {
minifyCss: true,
minifyJs: false,
recursive: 2,
output: 'site.html',
logLevel: LogLevel.INFO,
});
// Save to disk
fs.writeFileSync('output.html', result.html);
### Advanced API Usage
You can access individual building blocks too:
```typescript
import {
generatePortableHTML,
generateRecursivePortableHTML,
bundleMultiPageHTML
} from 'portapack';
Function | Purpose |
---|---|
generatePortableHTML() |
Bundle a single file or URL |
generateRecursivePortableHTML() |
Crawl & bundle entire site |
bundleMultiPageHTML() |
Combine multiple HTMLs with router |
Metric | Value |
---|---|
📦 Version | |
✅ Build | |
🧪 Coverage |
MIT — Built by Manic.agency