In this section, we are going to talk about the key points of deployments to avoid most problems during deployment.
Build Tools
As Prerequisites mentioned, you’ll need to set up those tools on your deployment environment.
Installing Dependencies
We use NPM for managing the theme’s dependencies, it’s necessary to install the dependencies on deployment environment, since we SHOULD NOT commit the node_modules
folder.
1$ npm i
npm i
is the shortcut ofnpm install
.
The
package.json
andpackage-lock.json
MUST be committed, npm relies on the former, the later will save the installation time.
Building Site
It’s time to build the site after installing the dependencies.
1$ hugo --gc --minify
--minify
minify the final HTML.
You can change the
baseURL
via the-b
flag.
The command generated the site and save it under the public
directory by default.
Deploying Site
This step depends on the which deployment methods you use.
Comments