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

@ -15,7 +15,7 @@ permissions:
# Environment variables available to all jobs and steps in this workflow # Environment variables available to all jobs and steps in this workflow
env: env:
HUGO_ENV: production HUGO_ENV: production
HUGO_VERSION: "0.115.4" HUGO_VERSION: "0.118.2"
GO_VERSION: "1.20.5" GO_VERSION: "1.20.5"
NODE_VERSION: "18.15.0" NODE_VERSION: "18.15.0"
TINA_CLIENT_ID: ${{ vars.TINA_CLIENT_ID }} TINA_CLIENT_ID: ${{ vars.TINA_CLIENT_ID }}

1
.gitignore vendored
View File

@ -13,6 +13,5 @@ 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

View File

@ -3,7 +3,7 @@ stages:
variables: variables:
HUGO_ENV: production HUGO_ENV: production
HUGO_VERSION: "0.115.4" HUGO_VERSION: "0.118.2"
GO_VERSION: "1.20.5" GO_VERSION: "1.20.5"
NODE_VERSION: "18.16.1" NODE_VERSION: "18.16.1"

View File

@ -4,11 +4,11 @@ frontend:
preBuild: preBuild:
commands: commands:
- yum install -y curl - yum install -y curl
- curl -LO "https://github.com/gohugoio/hugo/releases/download/v0.115.4/hugo_extended_0.115.4_Linux-64bit.tar.gz" - curl -LO "https://github.com/gohugoio/hugo/releases/download/v0.118.2/hugo_extended_0.118.2_Linux-64bit.tar.gz"
- tar -xvf hugo_extended_0.115.4_Linux-64bit.tar.gz - tar -xvf hugo_extended_0.118.2_Linux-64bit.tar.gz
- mv hugo /usr/local/bin/ - mv hugo /usr/local/bin/
- rm hugo_extended_0.115.4_Linux-64bit.tar.gz - rm hugo_extended_0.118.2_Linux-64bit.tar.gz
- echo "HUGO 0.115.4 INSTALLED" - echo "HUGO 0.118.2 INSTALLED"
- curl -LO "https://dl.google.com/go/go1.20.5.linux-amd64.tar.gz" - curl -LO "https://dl.google.com/go/go1.20.5.linux-amd64.tar.gz"
- tar -C /usr/local -xzf go1.20.5.linux-amd64.tar.gz - tar -C /usr/local -xzf go1.20.5.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin - export PATH=$PATH:/usr/local/go/bin

View File

@ -25,5 +25,4 @@ require (
github.com/gethugothemes/hugo-modules/tab v0.0.0-20230823074046-d7ebb75df8b9 // indirect 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/table-of-contents v0.0.0-20230823074046-d7ebb75df8b9 // indirect
github.com/gethugothemes/hugo-modules/videos 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)' source = 'assets/.*\.(css|scss|sass)'
target = 'css' target = 'css'
[[build.cachebusters]] [[build.cachebusters]]
source = 'data/.*\.(.*)$'
target = 'css'
[[build.cachebusters]]
source = 'assets/.*\.(.*)$' source = 'assets/.*\.(.*)$'
target = '$1' target = '$1'

View File

@ -3,25 +3,6 @@ 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);
@ -47,7 +28,7 @@ if (theme.fonts.font_family.secondary) {
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: ["./hugo_stats_decoded.json"], content: ["./hugo_stats.json"],
safelist: [{ pattern: /^swiper-/ }], safelist: [{ pattern: /^swiper-/ }],
darkMode: "class", darkMode: "class",
theme: { theme: {

View File

@ -3,5 +3,5 @@ publish = "public"
command = "yarn project-setup; yarn build" command = "yarn project-setup; yarn build"
[build.environment] [build.environment]
HUGO_VERSION = "0.115.4" HUGO_VERSION = "0.118.2"
GO_VERSION = "1.20.5" GO_VERSION = "1.20.5"

View File

@ -1,7 +1,7 @@
{ {
"name": "hugoplate", "name": "hugoplate",
"description": "hugo tailwindcss boilerplate", "description": "hugo tailwindcss boilerplate",
"version": "1.7.5", "version": "1.7.6",
"license": "MIT", "license": "MIT",
"author": "zeon.studio", "author": "zeon.studio",
"scripts": { "scripts": {
@ -22,11 +22,11 @@
"@tailwindcss/forms": "^0.5.6", "@tailwindcss/forms": "^0.5.6",
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.9",
"autoprefixer": "^10.4.15", "autoprefixer": "^10.4.15",
"postcss": "^8.4.28", "postcss": "^8.4.29",
"postcss-cli": "^10.1.0", "postcss-cli": "^10.1.0",
"prettier": "^3.0.2", "prettier": "^3.0.3",
"prettier-plugin-go-template": "0.0.15", "prettier-plugin-go-template": "0.0.15",
"prettier-plugin-tailwindcss": "^0.5.3", "prettier-plugin-tailwindcss": "^0.5.4",
"tailwind-bootstrap-grid": "^5.0.1", "tailwind-bootstrap-grid": "^5.0.1",
"tailwindcss": "^3.3.3" "tailwindcss": "^3.3.3"
} }

View File

@ -9,8 +9,8 @@
</h2> </h2>
<p align="center"> <p align="center">
<a href="https://github.com/gohugoio/hugo/releases/tag/v0.115.1" alt="Contributors"> <a href="https://github.com/gohugoio/hugo/releases/tag/v0.118.2" alt="Contributors">
<img src="https://img.shields.io/static/v1?label=min-HUGO-version&message=0.115.1&color=f00&logo=hugo" /> <img src="https://img.shields.io/static/v1?label=min-HUGO-version&message=0.118.2&color=f00&logo=hugo" />
</a> </a>
<a href="https://github.com/zeon-studio/hugoplate/blob/main/LICENSE"> <a href="https://github.com/zeon-studio/hugoplate/blob/main/LICENSE">

View File

@ -4,7 +4,7 @@ licenselink = "https://github.com/zeon-studio/hugoplate/blob/main/LICENSE"
description = "Hugoplate is a free starter template built with Hugo, and TailwindCSS, providing everything you need to jumpstart your Hugo project and save valuable time." description = "Hugoplate is a free starter template built with Hugo, and TailwindCSS, providing everything you need to jumpstart your Hugo project and save valuable time."
homepage = "https://github.com/zeon-studio/hugoplate" homepage = "https://github.com/zeon-studio/hugoplate"
demosite = "https://hugoplate.netlify.app/" demosite = "https://hugoplate.netlify.app/"
min_version = "0.115.4" min_version = "0.118.2"
tags = [ tags = [
"blog", "blog",

View File

@ -3,7 +3,7 @@
# default versions # default versions
NODE_VERSION='18.16.1'; NODE_VERSION='18.16.1';
GO_VERSION='1.20.5'; GO_VERSION='1.20.5';
HUGO_VERSION='0.115.4'; HUGO_VERSION='0.118.2';
# install Node.js # install Node.js
# echo "Installing Node.js $NODE_VERSION..." # echo "Installing Node.js $NODE_VERSION..."