1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-28 07:39:57 +02:00

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.
This commit is contained in:
XhmikosR
2020-02-22 08:54:43 +02:00
committed by GitHub
parent 9d50c6a18f
commit b8ffcdf9a4
5 changed files with 8 additions and 9 deletions

View File

@@ -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>

View File

@@ -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 }}

View File

@@ -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 -}}

View File

@@ -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 -}}