added decode_unicode function for tailwind and hugo_stats
This commit is contained in:
parent
460ef7af5d
commit
34cb72d4ce
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,5 +13,6 @@ resources
|
||||
.hugo_build.lock
|
||||
jsconfig.json
|
||||
hugo_stats.json
|
||||
hugo_stats_decoded.json
|
||||
go.sum
|
||||
yarn.lock
|
@ -3,6 +3,25 @@ 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);
|
||||
@ -28,10 +47,7 @@ if (theme.fonts.font_family.secondary) {
|
||||
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
"./hugo_stats.json",
|
||||
"./themes/**/layouts/**/*.html"
|
||||
],
|
||||
content: ["./hugo_stats_decoded.json"],
|
||||
safelist: [{ pattern: /^swiper-/ }],
|
||||
darkMode: "class",
|
||||
theme: {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "hugoplate",
|
||||
"description": "hugo tailwindcss boilerplate",
|
||||
"version": "1.7.3",
|
||||
"version": "1.7.4",
|
||||
"license": "MIT",
|
||||
"author": "zeon.studio",
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user