forked from pglombardo/PasswordPusher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset_theme.js
More file actions
21 lines (16 loc) · 751 Bytes
/
Copy pathset_theme.js
File metadata and controls
21 lines (16 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const fs = require("fs");
const path = require("path");
// Get the theme name from the environment variable, default to "default"
const theme = (process.env.PWP__THEME || "default").toLowerCase();
const themesDir = path.resolve(__dirname, "./app/assets/stylesheets/themes");
const shimPath = path.join(themesDir, "_selected.scss");
const themeFilePath = path.join(themesDir, `${theme}.css`);
if (!fs.existsSync(themeFilePath)) {
console.error(`Error: Theme "${theme}" not found at ${themeFilePath}`);
process.exit(1);
}
const contents = `// Auto-generated by set_theme.js — do not edit manually.
@use "themes/${theme}";
`;
fs.writeFileSync(shimPath, contents, "utf8");
console.log(`Theme shim written: ${shimPath} (@use themes/${theme})`);