Skip to content

add vercel settings #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -99,4 +105,4 @@ module.exports = {
},
}),
],
};
};
34 changes: 23 additions & 11 deletions themes/hugoplate/layouts/partials/essentials/style.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

<!-- plugins + stylesheet -->
{{ $styles := slice }}


<!-- Process plugin CSS files -->
{{ range site.Params.plugins.css }}
{{ if findRE "^http" .link }}
<link
Expand All @@ -43,17 +46,26 @@
{{ $styles = $styles | append (resources.Get .link) }}
{{ end }}
{{ end }}
{{ $styles := $styles | append (resources.Get "scss/main.scss" | toCSS) }}
{{ $styles := $styles | resources.Concat "css/style.css" }}
{{ $styles = $styles | css.PostCSS }}


<!-- Process main SCSS -->
{{ $mainScss := resources.Get "scss/main.scss" }}
{{ $mainStyle := $mainScss | toCSS }}
{{ $styles := $styles | append $mainStyle }}


<!-- Concatenate all styles -->
{{ $allStyles := $styles | resources.Concat "css/style.css" }}


<!-- Process for production or development -->
{{ if hugo.IsProduction }}
{{ $styles = $styles | resources.ExecuteAsTemplate "css/style.css" . | minify | fingerprint | resources.PostProcess }}
{{ $allStyles = $allStyles | resources.ExecuteAsTemplate "css/style.css" . | minify | fingerprint }}
<link
href="{{ $allStyles.RelPermalink }}"
integrity="{{ $allStyles.Data.Integrity }}"
rel="stylesheet" />
{{ else }}
{{ $styles = $styles | resources.ExecuteAsTemplate "css/style.css" . }}
{{ $allStyles = $allStyles | resources.ExecuteAsTemplate "css/style.css" . }}
<link href="{{ $allStyles.RelPermalink }}" rel="stylesheet" />
{{ end }}


<link
href="{{ $styles.RelPermalink }}"
integrity="{{ $styles.Data.Integrity }}"
rel="stylesheet" />
13 changes: 13 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -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"
}