Skip to content

Commit

Permalink
feat: recognize env via -e argument in addition to HUGO_ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
gcushen authored and YoungWilliamZ committed Jul 29, 2020
1 parent 793e62e commit 95a1f85
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion layouts/partials/marketing/google_analytics.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ $ga := site.Params.marketing.google_analytics | default site.GoogleAnalytics | default "" }}
{{ $gtm := site.Params.marketing.google_tag_manager | default "" }}

{{ if eq (getenv "HUGO_ENV") "production" | and $ga | and (not $gtm) }}
{{ if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and $ga | and (not $gtm) }}

{{ $gtag_config := cond site.Params.privacy_pack "{ 'anonymize_ip': true }" "{}" }}
<script async src="https://www.googletagmanager.com/gtag/js?id={{$ga}}"></script>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/marketing/google_tag_manager.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if eq (getenv "HUGO_ENV") "production" | and site.Params.marketing.google_tag_manager }}
{{ if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") | and site.Params.marketing.google_tag_manager }}
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/site_head.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
{{ $css_comment := printf "/*!* Source Themes Academic v%s (https://sourcethemes.com/academic/) */\n" site.Data.academic.version }}
{{ $css_bundle_head := $css_comment | resources.FromString "css/bundle-head.css" }}
{{ $css_options := dict "targetPath" "css/academic.css" }}
{{- if (eq (getenv "HUGO_ENV") "production") -}}
{{- if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") -}}
{{- $css_options = merge $css_options (dict "outputStyle" "compressed") -}}
{{- end -}}
{{ $sass_template := resources.Get "scss/main.scss" }}
Expand Down

0 comments on commit 95a1f85

Please sign in to comment.