Skip to main content

max / goingson

Use cross-platform Node script for CSS minification Replace shell-only beforeBuildCommand with a Node.js equivalent that works on macOS, Linux, and Windows without platform-specific Tauri configs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author: Max J. <87768334+MaxJMath@users.noreply.github.com> · 2026-05-10 16:10 UTC
Commit: 46401c29007b4979112ee4a65b3b18b41f9c8486
Parent: ce3f06d
2 files changed, +20 insertions, -3 deletions
@@ -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,8 +4,8 @@
4 4 "version": "0.3.1",
5 5 "identifier": "com.goingson.app",
6 6 "build": {
7 - "beforeBuildCommand": "./src-tauri/frontend/build-css.sh",
8 - "beforeDevCommand": "./src-tauri/frontend/build-css.sh",
7 + "beforeBuildCommand": "node src-tauri/frontend/build-css.js",
8 + "beforeDevCommand": "node src-tauri/frontend/build-css.js",
9 9 "frontendDist": "../src-tauri/frontend"
10 10 },
11 11 "app": {
@@ -23,7 +23,7 @@
23 23 }
24 24 ],
25 25 "security": {
26 - "csp": null
26 + "csp": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:"
27 27 }
28 28 },
29 29 "bundle": {