Added a separate file for color variables

This commit is contained in:
Ari 2025-05-15 02:24:42 -04:00
parent cebae8c7ae
commit ec73af5618
No known key found for this signature in database
4 changed files with 14 additions and 13 deletions

View file

@ -11,6 +11,7 @@ export const themePlugin = (): Plugin => {
name: 'theme-generator',
transform(code, id) {
if (id.endsWith('app.css')) {
const colorsCode = Deno.readTextFileSync(Deno.cwd() + '/src/themes/colors.css');
// Read the theme file and replace the contents of app.css with it
// Needs full path to the file
const themeCode = Deno.readTextFileSync(Deno.cwd() + '/src/themes/' + themeFile);
@ -18,7 +19,7 @@ export const themePlugin = (): Plugin => {
// and add a comment at the top
const themeComment = `/* Generated from ${themeFile} */\n`;
const themeCodeWithComment = themeComment + themeCode;
const themeCodeWithComment = themeComment + colorsCode + themeCode;
// Return the theme code as the new contents of app.css
return {
code: themeCodeWithComment,