diff --git a/.gitignore b/.gitignore index 0c14a96..3d9a473 100755 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,6 @@ resources .hugo_build.lock jsconfig.json hugo_stats.json +hugo_stats_decoded.json go.sum yarn.lock \ No newline at end of file diff --git a/exampleSite/tailwind.config.js b/exampleSite/tailwind.config.js index 19940a5..9c9f279 100755 --- a/exampleSite/tailwind.config.js +++ b/exampleSite/tailwind.config.js @@ -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: { diff --git a/package.json b/package.json index 844dfce..e56ed3e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "hugoplate", "description": "hugo tailwindcss boilerplate", - "version": "1.7.3", + "version": "1.7.4", "license": "MIT", "author": "zeon.studio", "scripts": {