]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Use `hugo.Environment` instead of `getenv` (#29240)
authorXhmikosR <xhmikosr@gmail.com>
Sat, 22 Feb 2020 06:54:43 +0000 (08:54 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Feb 2020 06:54:43 +0000 (08:54 +0200)
This is set automatically to "development" when the local server is running, and to "production" when Hugo builds the site.

package.json
site/layouts/_default/examples.html
site/layouts/partials/scripts.html
site/layouts/partials/stylesheet.html
site/layouts/robots.txt

index a209786acb3846570bfabe1b2459348d6db08194..32e45fd0830d0e1280999f56a2d67c8864871c1c 100644 (file)
@@ -49,7 +49,6 @@
     "docs": "npm-run-all docs-build docs-lint",
     "docs-build": "hugo --cleanDestinationDir",
     "docs-compile": "npm run docs-build",
-    "docs-production": "cross-env HUGO_ENV=production npm run docs-build",
     "docs-linkinator": "linkinator _gh_pages --recurse --silent --skip \"^(?!http://localhost)\"",
     "docs-vnu": "node build/vnu-jar.js",
     "docs-lint": "npm-run-all --parallel docs-vnu docs-linkinator",
     "docs-serve-only": "serve _gh_pages --listen 9001",
     "lockfile-lint": "lockfile-lint --allowed-hosts npm --allowed-schemes https: --empty-hostname false --type npm --path package-lock.json",
     "update-deps": "ncu -u -x karma-browserstack-launcher,popper.js && npm update && echo Manually update site/assets/js/vendor",
-    "release": "npm-run-all dist release-sri release-zip docs-production",
+    "release": "npm-run-all dist release-sri release-zip docs-build",
     "release-sri": "node build/generate-sri.js",
     "release-version": "node build/change-version.js",
     "release-zip": "cross-env-shell \"rm -rf bootstrap-$npm_package_version-dist && cp -r dist/ bootstrap-$npm_package_version-dist && zip -r9 bootstrap-$npm_package_version-dist.zip bootstrap-$npm_package_version-dist && rm -rf bootstrap-$npm_package_version-dist\"",
     "dist": "npm-run-all --parallel css js",
     "test": "npm-run-all lint dist js-test docs-build docs-lint",
-    "netlify": "npm-run-all dist release-sri docs-production",
+    "netlify": "npm-run-all dist release-sri docs-build",
     "watch": "npm-run-all --parallel watch-*",
     "watch-css-main": "nodemon --watch scss/ --ext scss --exec \"npm-run-all css-lint css-compile css-prefix\"",
     "watch-css-docs": "nodemon --watch site/assets/scss/ --ext scss --exec \"npm run css-lint\"",
index 5e2e58ea8e6f5f334df1e99f187521451a4a9539..6142e29ad511ce3161582aa7d49dc60f65e68986 100644 (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>
index e458d47e2d211c10a76bb8620107ec7a87abfc9d..afe7bd8121b340165df902b68f321e2bbb8537d3 100644 (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 }}
 
index 705f5fa7384320ff4a6e637051c2e438c089a283..f61c07f7628de7a4ed14b36cf52c425fc3e5ea15 100644 (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 -}}
 
index 5dd1a294ec5045acf6db93c4226ae5bee13c034c..271b4f1b7b4275649d408879edca9723c10621b2 100644 (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 -}}