Add build script and gitignore for settings theme
Build script minifies and base64-encodes the theme for telnet transfer. Outputs to settings-theme/dist/ (gitignored). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
ad306bc6bc
commit
bc3ca0f3b9
2 files changed
+30
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
dist/
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const src = path.join(__dirname, 'com.palm.app.settings.js');
|
||||||
|
const code = fs.readFileSync(src, 'utf8');
|
||||||
|
|
||||||
|
let minified = code
|
||||||
|
.replace(/\/\/[^\n]*/g, '')
|
||||||
|
.replace(/\/\*[\s\S]*?\*\//g, '')
|
||||||
|
.replace(/\n\s*\n/g, '\n')
|
||||||
|
.replace(/^\s+/gm, '')
|
||||||
|
.replace(/\n/g, '')
|
||||||
|
.replace(/ +/g, ' ');
|
||||||
|
|
||||||
|
console.log('Original size:', code.length, 'bytes');
|
||||||
|
console.log('Minified size:', minified.length, 'bytes');
|
||||||
|
|
||||||
|
const outDir = path.join(__dirname, 'dist');
|
||||||
|
fs.mkdirSync(outDir, { recursive: true });
|
||||||
|
|
||||||
|
const outPath = path.join(outDir, 'com.palm.app.settings.min.js');
|
||||||
|
fs.writeFileSync(outPath, minified);
|
||||||
|
console.log('Written to:', outPath);
|
||||||
|
|
||||||
|
const b64 = Buffer.from(minified).toString('base64');
|
||||||
|
const b64Path = path.join(outDir, 'com.palm.app.settings.b64');
|
||||||
|
fs.writeFileSync(b64Path, b64);
|
||||||
|
console.log('Base64 size:', b64.length, 'bytes');
|
||||||
|
console.log('Base64 written to:', b64Path);
|
||||||
Reference in new issue
Block a user