const fs = require('fs'); const path = `./node_modules/@tabler/icons/icons/outline/`; const fileNames = fs.readdirSync(path); const object = {}; const CONTENTS = { HEAD: "", TAIL: "", }; fileNames.forEach((filename) => { const contents = fs .readFileSync(path + filename) .toString() .trimEnd(); const lines = contents.split("\n"); const guts = lines .slice(1, lines.length - 1) .join("") .replace(/\ \ /g, ""); if (object) object[filename.slice(0, -4)] = guts; }); fs.writeFileSync( "./icons.js", `// Generated by build.js at ${new Date().toISOString()}\n\nmodule.exports = ${JSON.stringify( {...object, HEAD: CONTENTS['HEAD'], TAIL: CONTENTS['TAIL']} )};\n` );