Skip to content

manicinc/portapack

Repository files navigation

📦 PortaPack

npm version Build Status Codecov License: MIT

PortaPack Logo

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.

📚 Documentation

🚀 Quick Start

📦 Install

# Global CLI (recommended)
npm install -g portapack

# OR use npx (no install needed)
npx portapack ./index.html -o bundle.html

📋 CLI Examples

# 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

📦 Node.js API

PortaPack is fully usable via code.

Simple Usage

import { pack } from 'portapack';

const result = await pack('./index.html'); // local or URL
console.log(result.html); // bundled HTML

With Options

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

📊 Project Health

Metric Value
📦 Version npm
✅ Build Build Status
🧪 Coverage Codecov

📄 License

MIT — Built by Manic.agency

About

Pack websites into single portable HTML files

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •