aboutsummaryrefslogtreecommitdiff
path: root/site
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2020-02-22 08:54:43 +0200
committerGitHub <[email protected]>2020-02-22 08:54:43 +0200
commitb8ffcdf9a4b8d61ef896c102732e15af39e883b5 (patch)
tree913d0533f910408580e70dbacbfa6009521906ca /site
parent9d50c6a18fcfd2e42ccc4e7b29d887c574bfadea (diff)
downloadbootstrap-b8ffcdf9a4b8d61ef896c102732e15af39e883b5.tar.xz
bootstrap-b8ffcdf9a4b8d61ef896c102732e15af39e883b5.zip
Use `hugo.Environment` instead of `getenv` (#29240)
This is set automatically to "development" when the local server is running, and to "production" when Hugo builds the site.
Diffstat (limited to 'site')
-rw-r--r--site/layouts/_default/examples.html2
-rw-r--r--site/layouts/partials/scripts.html4
-rw-r--r--site/layouts/partials/stylesheet.html4
-rw-r--r--site/layouts/robots.txt2
4 files changed, 6 insertions, 6 deletions
diff --git a/site/layouts/_default/examples.html b/site/layouts/_default/examples.html
index 5e2e58ea8..6142e29ad 100644
--- a/site/layouts/_default/examples.html
+++ b/site/layouts/_default/examples.html
@@ -43,7 +43,7 @@
{{ .Content }}
{{ if ne .Page.Params.include_js false -}}
- {{- if eq (getenv "HUGO_ENV") "production" -}}
+ {{- if eq hugo.Environment "production" -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.min.js" integrity="{{ .Site.Params.cdn.js_bundle_hash }}" crossorigin="anonymous"></script>
{{- else -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script>
diff --git a/site/layouts/partials/scripts.html b/site/layouts/partials/scripts.html
index e458d47e2..afe7bd812 100644
--- a/site/layouts/partials/scripts.html
+++ b/site/layouts/partials/scripts.html
@@ -1,4 +1,4 @@
-{{ if eq (getenv "HUGO_ENV") "production" -}}
+{{ if eq hugo.Environment "production" -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.min.js" integrity="{{ .Site.Params.cdn.js_bundle_hash }}" crossorigin="anonymous"></script>
{{ else -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script>
@@ -13,7 +13,7 @@
{{- $targetDocsJSPath := printf "/docs/%s/assets/js/docs.js" .Site.Params.docs_version -}}
{{- $docsJs := append $js $vendor | resources.Concat $targetDocsJSPath -}}
-{{- if (eq (getenv "HUGO_ENV") "production") -}}
+{{- if eq hugo.Environment "production" -}}
{{- $docsJs = $docsJs | resources.Minify -}}
{{- end }}
diff --git a/site/layouts/partials/stylesheet.html b/site/layouts/partials/stylesheet.html
index 705f5fa73..f61c07f76 100644
--- a/site/layouts/partials/stylesheet.html
+++ b/site/layouts/partials/stylesheet.html
@@ -1,5 +1,5 @@
{{- "<!-- Bootstrap core CSS -->" | safeHTML }}
-{{ if eq (getenv "HUGO_ENV") "production" -}}
+{{ if eq hugo.Environment "production" -}}
<link href="/docs/{{ .Site.Params.docs_version }}/dist/css/bootstrap.min.css" rel="stylesheet" integrity="{{ .Site.Params.cdn.css_hash }}" crossorigin="anonymous">
{{- else -}}
<link href="/docs/{{ .Site.Params.docs_version }}/dist/css/bootstrap.css" rel="stylesheet">
@@ -10,7 +10,7 @@
{{- $sassOptions := dict "targetPath" $targetDocsCssPath "precision" 6 -}}
{{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}}
-{{- if (eq (getenv "HUGO_ENV") "production") -}}
+{{ if eq hugo.Environment "production" -}}
{{- $sassOptions = merge $sassOptions (dict "outputStyle" "compressed") -}}
{{- end -}}
diff --git a/site/layouts/robots.txt b/site/layouts/robots.txt
index 5dd1a294e..271b4f1b7 100644
--- a/site/layouts/robots.txt
+++ b/site/layouts/robots.txt
@@ -1,6 +1,6 @@
# www.robotstxt.org
-{{- $isProduction := eq (getenv "HUGO_ENV") "production" -}}
+{{- $isProduction := eq hugo.Environment "production" -}}
{{- $isNetlify := eq (getenv "NETLIFY") "true" -}}
{{- $allowCrawling := and (not $isNetlify) $isProduction -}}