move social and theme variables to data folder

This commit is contained in:
somrat sorkar
2023-07-08 10:12:11 +06:00
parent 78424c0065
commit e2374f93c3
9 changed files with 205 additions and 205 deletions

View File

@@ -1,12 +1,11 @@
const toml = require("toml");
const fs = require("fs");
const path = require("path");
const configPath = path.join(__dirname, "hugo.toml");
const getConfig = fs.readFileSync(configPath, "utf8");
const theme = JSON.parse(JSON.stringify(toml.parse(getConfig)));
const themePath = path.join(__dirname, "data/theme.json");
const themeRead = fs.readFileSync(themePath, "utf8");
const theme = JSON.parse(themeRead);
let font_base = Number(theme.params.fonts.font_size.base.replace("px", ""));
let font_scale = Number(theme.params.fonts.font_size.scale);
let font_base = Number(theme.fonts.font_size.base.replace("px", ""));
let font_scale = Number(theme.fonts.font_size.scale);
let h6 = font_base / font_base;
let h5 = h6 * font_scale;
let h4 = h5 * font_scale;
@@ -14,17 +13,17 @@ let h3 = h4 * font_scale;
let h2 = h3 * font_scale;
let h1 = h2 * font_scale;
let fontPrimary, fontPrimaryType, fontSecondary, fontSecondaryType;
if (theme.params.fonts.font_family.primary) {
fontPrimary = theme.params.fonts.font_family.primary
if (theme.fonts.font_family.primary) {
fontPrimary = theme.fonts.font_family.primary
.replace(/\+/g, " ")
.replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, "");
fontPrimaryType = theme.params.fonts.font_family.primary_type;
fontPrimaryType = theme.fonts.font_family.primary_type;
}
if (theme.params.fonts.font_family.secondary) {
fontSecondary = theme.params.fonts.font_family.secondary
if (theme.fonts.font_family.secondary) {
fontSecondary = theme.fonts.font_family.secondary
.replace(/\+/g, " ")
.replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, "");
fontSecondaryType = theme.params.fonts.font_family.secondary_type;
fontSecondaryType = theme.fonts.font_family.secondary_type;
}
/** @type {import('tailwindcss').Config} */
@@ -46,25 +45,25 @@ module.exports = {
},
extend: {
colors: {
text: theme.params.colors.default.text_color.default,
light: theme.params.colors.default.text_color.light,
dark: theme.params.colors.default.text_color.dark,
primary: theme.params.colors.default.theme_color.primary,
secondary: theme.params.colors.default.theme_color.secondary,
body: theme.params.colors.default.theme_color.body,
border: theme.params.colors.default.theme_color.border,
"theme-light": theme.params.colors.default.theme_color.theme_light,
"theme-dark": theme.params.colors.default.theme_color.theme_dark,
text: theme.colors.default.text_color.default,
light: theme.colors.default.text_color.light,
dark: theme.colors.default.text_color.dark,
primary: theme.colors.default.theme_color.primary,
secondary: theme.colors.default.theme_color.secondary,
body: theme.colors.default.theme_color.body,
border: theme.colors.default.theme_color.border,
"theme-light": theme.colors.default.theme_color.theme_light,
"theme-dark": theme.colors.default.theme_color.theme_dark,
darkmode: {
text: theme.params.colors.darkmode.text_color.default,
light: theme.params.colors.darkmode.text_color.light,
dark: theme.params.colors.darkmode.text_color.dark,
primary: theme.params.colors.darkmode.theme_color.primary,
secondary: theme.params.colors.darkmode.theme_color.secondary,
body: theme.params.colors.darkmode.theme_color.body,
border: theme.params.colors.darkmode.theme_color.border,
"theme-light": theme.params.colors.darkmode.theme_color.theme_light,
"theme-dark": theme.params.colors.darkmode.theme_color.theme_dark,
text: theme.colors.darkmode.text_color.default,
light: theme.colors.darkmode.text_color.light,
dark: theme.colors.darkmode.text_color.dark,
primary: theme.colors.darkmode.theme_color.primary,
secondary: theme.colors.darkmode.theme_color.secondary,
body: theme.colors.darkmode.theme_color.body,
border: theme.colors.darkmode.theme_color.border,
"theme-light": theme.colors.darkmode.theme_color.theme_light,
"theme-dark": theme.colors.darkmode.theme_color.theme_dark,
},
},
fontSize: {