#!/usr/bin/env node /** * Simple CSS minification script * Minifies tractatus-theme.css to tractatus-theme.min.css */ const fs = require('fs'); const path = require('path'); const cssPath = path.join(__dirname, '../public/css/tractatus-theme.css'); const minPath = path.join(__dirname, '../public/css/tractatus-theme.min.css'); // Read CSS const css = fs.readFileSync(cssPath, 'utf8'); // Simple minification: // 1. Remove comments // 2. Remove extra whitespace // 3. Remove newlines const minified = css .replace(/\/\*[\s\S]*?\*\//g, '') // Remove comments .replace(/\s+/g, ' ') // Collapse whitespace .replace(/\s*([{}:;,])\s*/g, '$1') // Remove spaces around special chars .replace(/;\}/g, '}') // Remove last semicolon before } .trim(); // Write minified CSS fs.writeFileSync(minPath, minified); console.log(`✓ Minified ${cssPath}`); console.log(` Original: ${css.length} bytes`); console.log(` Minified: ${minified.length} bytes`); console.log(` Saved: ${((1 - minified.length / css.length) * 100).toFixed(1)}%`);