Skip to content

Commit

Permalink
feat(init): Enable PWA on production environment
Browse files Browse the repository at this point in the history
Signed-off-by: Khusika Dhamar Gusti <[email protected]>
  • Loading branch information
Khusika Dhamar Gusti committed Jul 31, 2021
1 parent f5513e4 commit 8d52d26
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
{{- if ne .Site.Params.footer.enable false -}}
{{- partial "footer.html" . -}}
{{- end -}}
{{- if eq .Site.Params.pwa.enable true -}}
{{- if eq hugo.Environment "production" -}}
{{- with (eq $.Site.Params.pwa.enable "true") -}}
{{- partial "pwa.html" . -}}
{{- end -}}
{{- end -}}
</footer>
</div>

Expand Down
4 changes: 3 additions & 1 deletion layouts/partials/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,11 @@
{{- end -}}
{{- end -}}

{{- if eq $.Site.Params.pwa.enable true -}}
{{- if eq hugo.Environment "production" -}}
{{- with (eq $.Site.Params.pwa.enable "true") -}}
{{- dict "Source" "sw.js" "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- end -}}

{{- /* Cookie Consent */ -}}
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/init.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{{- .Scratch.Set "comment" dict -}}
{{- end -}}
{{- else if eq .Site .Sites.First -}}
{{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}}
{{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\", \"fingerprint\" and \"PWA\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\", \"fingerprint\" 和 \"PWA\" 不会启用.\n" -}}
{{- end -}}

{{- .Scratch.Set "params" $params -}}
Expand Down

0 comments on commit 8d52d26

Please sign in to comment.