Prerequisites

Please make sure you meet the prerequisites prior to using or developing the HB and its modules.

Required Configurations

hugo.toml

1[build]
2  writeStats = true

hugo.yaml

1build:
2  writeStats: true

hugo.json

1{
2   "build": {
3      "writeStats": true
4   }
5}
  • The build.writeStats is used to collect used CSS, such as classes, ids and tags, which will be used to purging unused CSS.

Build Tools

NameVersionDescription
HugoVersionFor building site.
Go>=1.12Required by Hugo modules to install modules.
Git-Version Control Systems.
NodeJS>=16For building JavaScript.
PostCSS CLI-For transforming styles.
RTLCSS-Convert LTR CSS to RTL, optional if you don’t have RTL sites.
Autoprefixer-Parse CSS and add vendor prefixes to rules by Can I Use.
PurgeCSS-Remove unused CSS.

It’s recommended using the latest version of those tools as possible.

HB doesn’t require NPM or Yarn, but it’s recommended to have one, to install PostCSS CLI, RTLCSS, Autoprefixer and PurgeCSS with one command.

1npm i postcss-cli @fullhuman/postcss-purgecss autoprefixer rtlcss

You can also install those packages globally (with -g or --global flag).

1sudo npm i -g postcss-cli @fullhuman/postcss-purgecss autoprefixer rtlcss

Notes

Please Do Not Changing hb and hugopress Parameters via Language-Scoped Configurations

HB relies on the configurations cross modules, but there is an known issue that language-scoped parameters will override the params instead of deep merging, which break the configurations cross modules.

For example, the following configuration example is not allowed.

hugo.toml

1[language]
2[[language.en]]
3  [language.en.params]
4    [language.en.params.hb]
5      foo = 'bar'
6    [language.en.params.hugopress]
7      foo = 'bar'

hugo.yaml

1language:
2  en:
3  - params:
4      hb:
5        foo: bar
6      hugopress:
7        foo: bar

hugo.json

 1{
 2   "language": {
 3      "en": [
 4         {
 5            "params": {
 6               "hb": {
 7                  "foo": "bar"
 8               },
 9               "hugopress": {
10                  "foo": "bar"
11               }
12            }
13         }
14      ]
15   }
16}