Skip to content

Commit

Permalink
Use hugo.Environment instead of getenv (#132)
Browse files Browse the repository at this point in the history
This is set automatically to "development" when the local server is running, and to "production" when Hugo builds the site.
  • Loading branch information
XhmikosR committed Mar 6, 2020
1 parent 7073022 commit f11962c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/layouts/partials/stylesheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- $sassOptions := dict "targetPath" "assets/css/docs.css" "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 -}}

Expand Down
2 changes: 1 addition & 1 deletion docs/layouts/robots.txt
Original file line number Diff line number Diff line change
@@ -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 -}}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"icons": "node build/build-svgs.js",
"icons-zip": "cross-env-shell \"shx rm -rf bootstrap-icons-$npm_package_version && shx cp -r icons/ bootstrap-icons-$npm_package_version && zip -r9 bootstrap-icons-$npm_package_version.zip bootstrap-icons-$npm_package_version && shx rm -rf bootstrap-icons-$npm_package_version\"",
"push-pages": "cd _site && git init && git remote add staging https://github.com/twbs/icons/ && git add . && git commit -m \"Publishing latest changes\" && git push staging master:gh-pages --force && git remote rm staging",
"publish": "cross-env HUGO_ENV=production npm-run-all docs-build push-pages",
"netlify": "cross-env HUGO_ENV=production npm-run-all icons docs-build",
"publish": "npm-run-all docs-build push-pages",
"netlify": " npm-run-all icons docs-build",
"test:fusv": "fusv docs/assets/scss/",
"test:eslint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives .",
"test:stylelint": "stylelint docs/assets/scss/ --cache --cache-location node_modules/.cache/.stylelintcache",
Expand Down

0 comments on commit f11962c

Please sign in to comment.