A minimalist HTML compression tool with live editing and preview live file.
Titan HTML Editor
A minimalist HTML compression tool with live editing and preview capabilities using the modern gzip streaming API. Edit, compress, and preview HTML files in real-time with an intuitive drag-and-drop interface.
- Live HTML Editing: Real-time code editor with syntax highlighting
- Gzip Compression: Compress HTML using the native CompressionStream API
- Live Preview: Instant preview of your HTML changes in an isolated iframe
- Drag-and-Drop: Simply drag HTML files into the editor to load them
- File Processing: Save compressed or uncompressed HTML files
- Compression Stats: View original vs compressed file sizes
- Base64 Encoding: Export compressed data as Base64 for easy sharing
- Zero Dependencies: Pure vanilla JavaScript with no external libraries
- Responsive Design: Works seamlessly on desktop and mobile devices
- Clone the repository:
git clone https://github.com/yourusername/titan-html-editor.git
cd titan-html-editor- Open
index.htmlin your web browser:
# On macOS
open index.html
# On Linux
xdg-open index.html
# On Windows
start index.htmlNo build process or installation required!
For best results, serve the files using a local web server:
# Using Python 3
python -m http.server 8000
# Using Node.js (with npx)
npx serve
# Using PHP
php -S localhost:8000Then navigate to http://localhost:8000 in your browser.
- Type or Paste HTML: Use the editor panel to write or paste your HTML code
- Live Preview: See changes instantly in the preview pane
- Compress: Click the "Compress" button to gzip your HTML
- Download: Save the compressed or original file to your device
- Drag any HTML file onto the editor area
- The file content will be loaded automatically
- Edit and compress as needed
- Load or write your HTML content
- Click "Compress with Gzip" to compress the content
- View compression statistics (original size vs compressed size)
- Download the compressed
.gzfile or Base64 encoded output - Use "Decompress" to restore the original HTML
Ctrl/Cmd + S: Save current HTML fileCtrl/Cmd + O: Open file dialogCtrl/Cmd + K: Compress HTMLCtrl/Cmd + L: Clear editor
// Compress HTML using CompressionStream API
async function compressHTML(htmlString) {
const blob = new Blob([htmlString], { type: 'text/html' });
const stream = blob.stream();
const compressedStream = stream.pipeThrough(
new CompressionStream('gzip')
);
const compressedBlob = await new Response(compressedStream).blob();
return compressedBlob;
}
// Decompress gzipped HTML
async function decompressHTML(compressedBlob) {
const stream = compressedBlob.stream();
const decompressedStream = stream.pipeThrough(
new DecompressionStream('gzip')
);
const decompressedBlob = await new Response(decompressedStream).blob();
return await decompressedBlob.text();
}
⬇ README.md