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
|
.hugo_build.lock
|
||||||
jsconfig.json
|
jsconfig.json
|
||||||
hugo_stats.json
|
hugo_stats.json
|
||||||
|
hugo_stats_decoded.json
|
||||||
go.sum
|
go.sum
|
||||||
yarn.lock
|
yarn.lock
|
@ -3,6 +3,25 @@ const path = require("path");
|
|||||||
const themePath = path.join(__dirname, "data/theme.json");
|
const themePath = path.join(__dirname, "data/theme.json");
|
||||||
const themeRead = fs.readFileSync(themePath, "utf8");
|
const themeRead = fs.readFileSync(themePath, "utf8");
|
||||||
const theme = JSON.parse(themeRead);
|
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_base = Number(theme.fonts.font_size.base.replace("px", ""));
|
||||||
let font_scale = Number(theme.fonts.font_size.scale);
|
let font_scale = Number(theme.fonts.font_size.scale);
|
||||||
@ -28,10 +47,7 @@ if (theme.fonts.font_family.secondary) {
|
|||||||
|
|
||||||
/** @type {import('tailwindcss').Config} */
|
/** @type {import('tailwindcss').Config} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
content: [
|
content: ["./hugo_stats_decoded.json"],
|
||||||
"./hugo_stats.json",
|
|
||||||
"./themes/**/layouts/**/*.html"
|
|
||||||
],
|
|
||||||
safelist: [{ pattern: /^swiper-/ }],
|
safelist: [{ pattern: /^swiper-/ }],
|
||||||
darkMode: "class",
|
darkMode: "class",
|
||||||
theme: {
|
theme: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "hugoplate",
|
"name": "hugoplate",
|
||||||
"description": "hugo tailwindcss boilerplate",
|
"description": "hugo tailwindcss boilerplate",
|
||||||
"version": "1.7.3",
|
"version": "1.7.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "zeon.studio",
|
"author": "zeon.studio",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user