diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..849ddff --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/settings-theme/build.js b/settings-theme/build.js new file mode 100644 index 0000000..82b0678 --- /dev/null +++ b/settings-theme/build.js @@ -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);