mirror of
https://github.com/10h30/astroplate.git
synced 2026-06-05 15:08:00 +09:00
update scripts
This commit is contained in:
@@ -10,10 +10,6 @@ const path = require("path");
|
||||
];
|
||||
|
||||
const configFiles = [
|
||||
{
|
||||
filePath: "tailwind.config.js",
|
||||
patterns: ["darkmode:\\s*{[^}]*},", 'darkMode:\\s*"class",'],
|
||||
},
|
||||
{ filePath: "src/config/theme.json", patterns: ["colors.darkmode"] },
|
||||
];
|
||||
|
||||
@@ -71,13 +67,9 @@ const path = require("path");
|
||||
|
||||
function removeDarkMode(configFile) {
|
||||
const { filePath, patterns } = configFile;
|
||||
if (filePath === "tailwind.config.js") {
|
||||
removeDarkModeFromFiles(filePath, patterns);
|
||||
} else {
|
||||
const contentFile = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
||||
patterns.forEach((pattern) => deleteNestedProperty(contentFile, pattern));
|
||||
fs.writeFileSync(filePath, JSON.stringify(contentFile));
|
||||
}
|
||||
const contentFile = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
||||
patterns.forEach((pattern) => deleteNestedProperty(contentFile, pattern));
|
||||
fs.writeFileSync(filePath, JSON.stringify(contentFile));
|
||||
}
|
||||
|
||||
function deleteNestedProperty(obj, propertyPath) {
|
||||
|
||||
@@ -47,8 +47,22 @@ module.exports = plugin.withOptions(() => {
|
||||
const groups = [
|
||||
{ colors: themeConfig.colors.default.theme_color, prefix: "" },
|
||||
{ colors: themeConfig.colors.default.text_color, prefix: "" },
|
||||
{ colors: themeConfig.colors.darkmode.theme_color, prefix: "darkmode-" },
|
||||
{ colors: themeConfig.colors.darkmode.text_color, prefix: "darkmode-" },
|
||||
...(themeConfig.colors.darkmode?.theme_color
|
||||
? [
|
||||
{
|
||||
colors: themeConfig.colors.darkmode.theme_color,
|
||||
prefix: "darkmode-",
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(themeConfig.colors.darkmode?.text_color
|
||||
? [
|
||||
{
|
||||
colors: themeConfig.colors.darkmode.text_color,
|
||||
prefix: "darkmode-",
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
// Set color variables
|
||||
|
||||
Reference in New Issue
Block a user