diff --git a/package.json b/package.json index 9b9691e..19184d9 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,14 @@ "build": "hugo --gc --minify --templateMetrics --templateMetricsHints --forceSyncStatic", "test": "hugo server --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --watch --forceSyncStatic -e production --minify", "dev:example": "cd exampleSite; hugo server", + "vercel-build": "curl -L -o go.tar.gz https://go.dev/dl/go1.21.0.linux-amd64.tar.gz && tar -C /usr/local -xzf go.tar.gz && export PATH=$PATH:/usr/local/go/bin && npm install && npm run build:tailwind && NODE_ENV=production && HUGO_ENVIRONMENT=production hugo --gc --minify", + "build:tailwind": "npx tailwindcss -i ./themes/hugoplate/assets/scss/main.scss -o ./themes/hugoplate/assets/css/style.css --minify", "build:example": "cd exampleSite; hugo --gc --minify --templateMetrics --templateMetricsHints --forceSyncStatic", "test:example": "cd exampleSite; hugo server --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --watch --forceSyncStatic -e production --minify", "update-modules": "node ./scripts/clearModules.js && hugo mod clean --all && hugo mod get -u ./... && hugo mod tidy", "format": "prettier -w ." }, - "devDependencies": { + "dependencies": { "@fullhuman/postcss-purgecss": "^5.0.0", "@tailwindcss/forms": "^0.5.6", "@tailwindcss/typography": "^0.5.10", diff --git a/tailwind.config.js b/tailwind.config.js index 3642bb6..5aec021 100755 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -28,7 +28,13 @@ if (theme.fonts.font_family.secondary) { /** @type {import('tailwindcss').Config} */ module.exports = { - content: ["./hugo_stats.json"], + content: [ + "./layouts/**/*.{html,js}", + "./themes/**/layouts/**/*.{html,js}", + "./content/**/*.{md,html}", + "./themes/**/content/**/*.{md,html}", + "./hugo_stats.json", + ], safelist: [{ pattern: /^swiper-/ }], darkMode: "class", theme: { @@ -99,4 +105,4 @@ module.exports = { }, }), ], -}; \ No newline at end of file +}; diff --git a/themes/hugoplate/layouts/partials/essentials/style.html b/themes/hugoplate/layouts/partials/essentials/style.html index 7149f6d..1b5c9a7 100755 --- a/themes/hugoplate/layouts/partials/essentials/style.html +++ b/themes/hugoplate/layouts/partials/essentials/style.html @@ -31,6 +31,9 @@ {{ $styles := slice }} + + + {{ range site.Params.plugins.css }} {{ if findRE "^http" .link }} +{{ $mainScss := resources.Get "scss/main.scss" }} +{{ $mainStyle := $mainScss | toCSS }} +{{ $styles := $styles | append $mainStyle }} + + + +{{ $allStyles := $styles | resources.Concat "css/style.css" }} + + + {{ if hugo.IsProduction }} - {{ $styles = $styles | resources.ExecuteAsTemplate "css/style.css" . | minify | fingerprint | resources.PostProcess }} + {{ $allStyles = $allStyles | resources.ExecuteAsTemplate "css/style.css" . | minify | fingerprint }} + {{ else }} - {{ $styles = $styles | resources.ExecuteAsTemplate "css/style.css" . }} + {{ $allStyles = $allStyles | resources.ExecuteAsTemplate "css/style.css" . }} + {{ end }} - - - diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..a90922f --- /dev/null +++ b/vercel.json @@ -0,0 +1,13 @@ +{ + "build": { + "env": { + "GO_VERSION": "1.21", + "HUGO_VERSION": "0.121.0", + "HUGO_ENVIRONMENT": "production", + "NODE_ENV": "production" + } + }, + "buildCommand": "npm run vercel-build", + "installCommand": "npm install", + "framework": "hugo" +}