Skip to content

Commit

Permalink
Merge pull request ubiquity#283 from hhio618/development
Browse files Browse the repository at this point in the history
fix: multiplatform support
  • Loading branch information
Keyrxng authored Aug 21, 2024
2 parents 92f0e61 + fcc9b8d commit 1ae7280
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions build/esbuild-build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
import { execSync } from "child_process";
import { config } from "dotenv";
import esbuild from "esbuild";
import { readFileSync, appendFileSync, writeFileSync } from "fs";
import { join } from "path";

// CSS files in order
const cssFiles: string[] = [
"static/styles/rewards/pay.css",
"static/styles/rewards/background.css",
"static/styles/toast.css",
"static/styles/rewards/claim-table.css",
"static/styles/rewards/media-queries.css",
"static/styles/rewards/light-mode.css",
];

// Output bundles file
const outputFilePath = "static/bundles/bundles.css";

const typescriptEntries = ["static/scripts/rewards/init.ts"];
export const entries = [...typescriptEntries];

Expand All @@ -27,12 +43,14 @@ export const esBuildContext: esbuild.BuildOptions = {
name: "css-bundle",
setup(build) {
build.onEnd((result) => {
execSync(`cat static/styles/rewards/pay.css > static/bundles/bundles.css`);
execSync(`cat static/styles/rewards/background.css >> static/bundles/bundles.css`);
execSync(`cat static/styles/toast.css >> static/bundles/bundles.css`);
execSync(`cat static/styles/rewards/claim-table.css >> static/bundles/bundles.css`);
execSync(`cat static/styles/rewards/media-queries.css >> static/bundles/bundles.css`);
execSync(`cat static/styles/rewards/light-mode.css >> static/bundles/bundles.css`);
// Clear the file first
writeFileSync(outputFilePath, "", "utf8");

// Concatenate each file into the bundles file
cssFiles.forEach((file) => {
const data = readFileSync(file, "utf8");
appendFileSync(outputFilePath, data, "utf8");
});
});
},
},
Expand Down

0 comments on commit 1ae7280

Please sign in to comment.