build: add build system

main
winston 2023-03-19 06:02:08 +01:00
parent 438945465d
commit 4a18383e27
No known key found for this signature in database
GPG Key ID: 3786770EDBC2B481
9 changed files with 55 additions and 6 deletions

45
build.ts Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run --allow-env
import { path, sass } from "./deps.ts";
const accents = [
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender",
];
const flavors = ["latte", "frappe", "macchiato", "mocha"];
const dirname = path.dirname(path.fromFileUrl(import.meta.url));
const builder = (flavor: string, accent: string) => `
@import "catppuccin/${flavor}";
$accent: $${accent};
$is-dark: ${flavor !== "latte"};
@import "theme";
`;
for (const flavor of flavors) {
for (const accent of accents) {
const input = builder(flavor, accent);
const result = await sass.compileStringAsync(input, {
loadPaths: [path.join(dirname, "src")],
});
Deno.mkdirSync(path.join(dirname, "dist"), { recursive: true });
await Deno.writeTextFile(
path.join(dirname, "dist", `theme-catppuccin-${flavor}-${accent}.css`),
result.css
);
}
}

2
deps.ts Normal file
View File

@ -0,0 +1,2 @@
export * as path from "https://deno.land/std@0.180.0/path/mod.ts";
export * as sass from "npm:sass-embedded";

View File

@ -1,12 +1,14 @@
@use "sass:color"; @use "sass:color";
@import "catppuccin/mocha";
$accent: $mauve;
:root { :root {
color-scheme: dark; @if $is-dark {
color-schema: dark;
} @else {
color-schema: light;
}
--is-dark-theme: $is-dark;
accent-color: #{$accent}; accent-color: #{$accent};
--is-dark-theme: true;
--color-primary: #{$accent}; --color-primary: #{$accent};
--color-primary-contrast: #{$crust}; --color-primary-contrast: #{$crust};
@ -239,4 +241,4 @@ $accent: $mauve;
} }
@import "chroma"; @import "chroma";
@import "../src/codemirror/dark"; // @import "../src/codemirror/dark";