项目初始化
This commit is contained in:
46
build.js
Normal file
46
build.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const sass = require("sass");
|
||||
const ctp = require("@catppuccin/palette");
|
||||
|
||||
const builder = (flavor, accent) => `
|
||||
@import "@catppuccin/palette/scss/${flavor}";
|
||||
$accent: $${accent};
|
||||
$isDark: ${flavor !== "latte"};
|
||||
@import "theme";
|
||||
`;
|
||||
|
||||
const accents = [
|
||||
"rosewater",
|
||||
"flamingo",
|
||||
"pink",
|
||||
"mauve",
|
||||
"red",
|
||||
"maroon",
|
||||
"peach",
|
||||
"yellow",
|
||||
"green",
|
||||
"teal",
|
||||
"sky",
|
||||
"sapphire",
|
||||
"blue",
|
||||
"lavender",
|
||||
];
|
||||
|
||||
for (const flavor of Object.keys(ctp.variants)) {
|
||||
for (const accent of accents) {
|
||||
const input = builder(flavor, accent);
|
||||
const result = sass.compileString(input, {
|
||||
loadPaths: [
|
||||
path.join(__dirname, "src"),
|
||||
path.join(__dirname, "node_modules"),
|
||||
],
|
||||
});
|
||||
|
||||
fs.mkdirSync(path.join(__dirname, "dist"), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname, "dist", `theme-catppuccin-${flavor}-${accent}.css`),
|
||||
result.css
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user