remove cusom hugo_stats decoder, fixed theme.json update auto reload

This commit is contained in:
somrat sorkar
2023-09-02 09:40:53 +06:00
parent 59eef62fde
commit 77bc7eef2d
12 changed files with 19 additions and 37 deletions

View File

@@ -25,5 +25,4 @@ require (
github.com/gethugothemes/hugo-modules/tab v0.0.0-20230823074046-d7ebb75df8b9 // indirect
github.com/gethugothemes/hugo-modules/table-of-contents v0.0.0-20230823074046-d7ebb75df8b9 // indirect
github.com/gethugothemes/hugo-modules/videos v0.0.0-20230823074046-d7ebb75df8b9 // indirect
github.com/zeon-studio/hugoplate v0.0.0-20230820074946-34cb72d4ce47 // indirect
)

View File

@@ -55,6 +55,9 @@ target = 'js'
source = 'assets/.*\.(css|scss|sass)'
target = 'css'
[[build.cachebusters]]
source = 'data/.*\.(.*)$'
target = 'css'
[[build.cachebusters]]
source = 'assets/.*\.(.*)$'
target = '$1'

View File

@@ -3,25 +3,6 @@ const path = require("path");
const themePath = path.join(__dirname, "data/theme.json");
const themeRead = fs.readFileSync(themePath, "utf8");
const theme = JSON.parse(themeRead);
const hugoStatsPath = path.join(__dirname, "hugo_stats.json");
const hugoStatsRead = fs.readFileSync(hugoStatsPath, "utf8");
// Function to decode Unicode escape sequences
function decodeUnicode(json) {
return JSON.parse(json, (key, value) => {
if (typeof value === "string") {
return value.replace(/\\u[\dA-Fa-f]{4}/g, (match) => {
return String.fromCharCode(parseInt(match.slice(2), 16));
});
}
return value;
});
}
fs.writeFileSync(
"hugo_stats_decoded.json",
JSON.stringify(decodeUnicode(hugoStatsRead), null, 2),
);
let font_base = Number(theme.fonts.font_size.base.replace("px", ""));
let font_scale = Number(theme.fonts.font_size.scale);
@@ -47,7 +28,7 @@ if (theme.fonts.font_family.secondary) {
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./hugo_stats_decoded.json"],
content: ["./hugo_stats.json"],
safelist: [{ pattern: /^swiper-/ }],
darkMode: "class",
theme: {