tractatus/scripts/minify-theme-css.js
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

34 lines
1 KiB
JavaScript

#!/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)}%`);