diff options
| author | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-05 00:06:22 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-05 00:06:22 +0300 |
| commit | 2b9c38a2711ae639a26a63ddfdc57c10538f4696 (patch) | |
| tree | 49c985a186e9d5bd662bb4b88e17479b71741ca4 | |
| parent | 1dec73cfa93cb2f93eab3d02c105201674128137 (diff) | |
| download | Project-Tick-2b9c38a2711ae639a26a63ddfdc57c10538f4696.tar.gz Project-Tick-2b9c38a2711ae639a26a63ddfdc57c10538f4696.zip | |
NOISSUE update LESS compilation method to use Less JS API for improved compatibility
Signed-off-by: Mehmet Samet Duman <yongdohyun@projecttick.org>
| -rw-r--r-- | ofborg/ofborg-viewer/build.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ofborg/ofborg-viewer/build.js b/ofborg/ofborg-viewer/build.js index bcdcbc889f..fd132cff3a 100644 --- a/ofborg/ofborg-viewer/build.js +++ b/ofborg/ofborg-viewer/build.js @@ -29,10 +29,22 @@ if (fs.existsSync(revFile)) { } const VERSION = JSON.parse(fs.readFileSync(path.join(ROOT, "package.json"), "utf-8")).version; -// 2. Compile LESS → CSS +// 2. Compile LESS → CSS using Less JS API (avoids ESM extensionless bin issue) console.log("Compiling LESS..."); const lessFile = path.join(ROOT, "src/styles/index.less"); -const cssOutput = execSync(`npx lessc ${lessFile}`, { encoding: "utf-8" }); +const helperFile = path.join(ROOT, ".less-compile.mjs"); +fs.writeFileSync(helperFile, ` +import less from "less"; +import { readFileSync } from "fs"; +const src = readFileSync(process.argv[2], "utf-8"); +const out = await less.render(src, { filename: process.argv[2] }); +process.stdout.write(out.css); +`); +const cssOutput = execSync(`node ${helperFile} ${lessFile}`, { + encoding: "utf-8", + cwd: ROOT, +}); +fs.unlinkSync(helperFile); // 3. Build JS bundle with esbuild console.log("Bundling JS..."); |
