Skip to main content

max / balanced_breakfast

build: F5 E-minify — add CSS minify pipeline (ported from GO) styles.css is now minified to styles.min.css by a mtime-gated build-css.js (clean-css), wired into tauri.conf as beforeBuildCommand + beforeDevCommand. index.html loads the minified stylesheet (70.7 KB -> 37.0 KB). The min file is gitignored (regenerated on every build/dev; per the never-store-regenerables preference). Note: GO tracks its styles.min.css; BB diverges here deliberately. Fresh checkouts stay runnable because the tauri-CLI hooks regenerate it before dev/build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-12 18:49 UTC
Commit: abfcb9923f63e3603fbf92aefd597518f16e9f57
Parent: a3cdd90
4 files changed, +23 insertions, -1 deletion
M .gitignore +3
@@ -1,6 +1,9 @@
1 1 # Build artifacts
2 2 /target/
3 3
4 + # Minified CSS (regenerated from styles.css by beforeBuildCommand/beforeDevCommand)
5 + src-tauri/frontend/css/styles.min.css
6 +
4 7 # Environment
5 8 .env
6 9
@@ -0,0 +1,17 @@
1 + const { execSync } = require("child_process");
2 + const fs = require("fs");
3 + const path = require("path");
4 +
5 + const cssDir = path.join(__dirname, "css");
6 + const src = path.join(cssDir, "styles.css");
7 + const dest = path.join(cssDir, "styles.min.css");
8 +
9 + if (!fs.existsSync(dest) || fs.statSync(src).mtimeMs > fs.statSync(dest).mtimeMs) {
10 + console.log("Minifying CSS...");
11 + execSync(`npx --yes clean-css-cli "${src}" -o "${dest}"`, { stdio: "inherit" });
12 + const srcSize = fs.statSync(src).size;
13 + const destSize = fs.statSync(dest).size;
14 + console.log(`CSS minified: ${srcSize} -> ${destSize} bytes`);
15 + } else {
16 + console.log("CSS already up to date");
17 + }
@@ -4,7 +4,7 @@
4 4 <meta charset="UTF-8">
5 5 <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
6 6 <title>Balanced Breakfast</title>
7 - <link rel="stylesheet" href="css/styles.css">
7 + <link rel="stylesheet" href="css/styles.min.css">
8 8 </head>
9 9 <body>
10 10 <div id="app">
@@ -4,6 +4,8 @@
4 4 "version": "0.3.3",
5 5 "identifier": "com.balancedbreakfast.app",
6 6 "build": {
7 + "beforeBuildCommand": "node src-tauri/frontend/build-css.js",
8 + "beforeDevCommand": "node src-tauri/frontend/build-css.js",
7 9 "frontendDist": "../src-tauri/frontend"
8 10 },
9 11 "app": {