Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/uPagge/uBlogger.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDillon <dillonzq@outlook.com>2020-03-02 12:03:35 +0300
committerDillon <dillonzq@outlook.com>2020-03-02 12:03:35 +0300
commit285efc01bbd6ff84f025b1acc5060233185e2f01 (patch)
tree123a3a4441a190accb784c8a383953c5b43c93e0
parentf83b1c14c88b36de419e0eeb3b7e335434bb2032 (diff)
feat(environment): use hugo.Environment to judge the production environment
-rw-r--r--.circleci/config.yml2
-rw-r--r--README.md8
-rw-r--r--README.zh.md8
-rw-r--r--layouts/_default/baseof.html2
-rw-r--r--package.json2
5 files changed, 3 insertions, 19 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index b13f345..4752606 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -8,7 +8,7 @@ jobs:
- checkout
- run: git submodule sync
- run: git submodule update --init
- - run: HUGO_ENV=production hugo --source=exampleSite -v --gc
+ - run: hugo --source=exampleSite -v --gc
- run: htmlproofer exampleSite/public --check-html --allow-hash-href --empty-alt-ignore --disable-external
workflows:
diff --git a/README.md b/README.md
index 25210d2..5cabbda 100644
--- a/README.md
+++ b/README.md
@@ -158,14 +158,6 @@ Customize `browserconfig.xml` and `site.webmanifest` to set theme-color and back
## Tips
-### Set `production` environment when generating site
-
-Because some features are only in production mode, so you need to add a `production` environment variables when generating your site.
-
-```bash
- HUGO_ENV=production hugo --gc --minify
-```
-
### How to toggle dark-light mode
* You can click the circle icon to toggle dark-light mode. In the desktop version the circle icon is to the right and in the mobile version is positioned to the left, close to the site title.
diff --git a/README.zh.md b/README.zh.md
index e7d9126..2e6374a 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -153,14 +153,6 @@
## 小技巧
-### 在生成网站时设置 `production` 环境变量
-
-由于主题的一些功能仅在生产环境有效,所以你需要在生成网站时设置 `production` 环境变量。
-
-```bash
- HUGO_ENV=production hugo --gc --minify
-```
-
### 怎样切换网站 暗黑-明亮 模式
* 你可以点击圆形图标来切换网站 暗黑-明亮 模式。桌面模式下圆形图标在网页右上角,移动设备模式下在网站左上角标题旁边
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index dd6a792..90f5b6f 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -5,7 +5,7 @@
{{- $scratch := newScratch -}}
{{- .Scratch.Set "scratch" $scratch -}}
-{{- if eq (getenv "HUGO_ENV") "production" -}}
+{{- if eq hugo.Environment "production" -}}
{{- $scratch.Set "production" true -}}
{{- $scratch.Set "CDN" .Site.Params.cdn -}}
{{- end -}}
diff --git a/package.json b/package.json
index 099ced9..565f324 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"scripts": {
"build": "npx babel src --out-file assets/js/theme.min.js --source-maps",
"start": "hugo server --source=exampleSite --themesDir=../.. --disableFastRender -D",
- "copy": "HUGO_ENV=production hugo -v --source=exampleSite --themesDir=../.. -D --gc --minify && rm -rf resources && cp -rf exampleSite/resources resources"
+ "copy": "hugo -v --source=exampleSite --themesDir=../.. -D --gc --minify && rm -rf resources && cp -rf exampleSite/resources resources"
},
"husky": {
"hooks": {