1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/build/generate-theme-vars-file.ts
Sebastian Malton 1e2feb92d1 Fix build and lint
- Get `make` to generate new `theme-vars.css` file when necessary

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-04-01 16:07:19 -04:00

28 lines
764 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import fs from "fs-extra";
import path from "path";
import defaultBaseLensTheme from "../src/renderer/themes/lens-dark";
const outputCssFile = path.resolve("src/renderer/themes/theme-vars.css");
const content = [
"/**",
" * Generated Lens theme CSS-variables, don't edit manually.",
" */",
"",
":root {",
...Object.entries(defaultBaseLensTheme.colors)
.map(([varName, value]) => ` --${varName}: ${value};`),
"}",
"",
].join("\n");
// Run
console.log("Writing out new generated src/renderer/themes/theme-vars.css file");
fs.ensureFileSync(outputCssFile);
fs.writeFile(outputCssFile, content);