Commands
Use npm commands to automate the build process and to keep track of dependencies.
Hinode supports
Node Package Manager
to automate the build process and to keep track of dependencies. The package.json
file in the repository root defines several commands to simplify local development and testing. The following paragraphs describe the main commands.
You will need to install the required Hugo modules before starting a local server. The following command downloads the latest available version of the configured modules recursively, vendors the modules, and does some housekeeping of the module files.
npm run mod:update
Use the following command from the command prompt to start a local development server. The command removes any previous build artifacts in the public
and resources
folders. The command invokes the local web server from Hugo, which watches for changes in the key system files and configuration directory. By default the generated site is available at http://localhost:1313/
and is responsive to changes. This allows for interactive development and testing. When in development mode, the generated assets (such as javascripts and CSS files) are not minified to simplify debugging.
npm run start
Use the following command to mimic the site in production mode. In this setting, generated assets are minified and compliant with the Content Security Policy. Although Hugo’s web server is not meant to be run in a real production environment, it does allow validation of the site in an environment close to production.
npm run start:prod
Use the following command to generate the static site. The build artifacts are stored in the local public
folder. You can deploy these files to your production server. The build command invokes mod:update
prior to the build.
npm run build
Add the prefix debug
to generate a site suitable for debugging. The build artifacts are not minified to simplify review and testing.
npm run build:debug
Use the the following command to analyze the source code and to test for any stylistic errors. The lint command validates three types of files in the assets
folder and content
folder:
assets/*.js
) using
eslint
.assets/scss/**/*.{css,sass,scss,sss,less}
) using
stylelint
.*.md
and content/**/*.md
) using
markdownlint-cli2
.The basic configuration of these linting tools is defined in the repository root.
npm run lint
Be sure to adhere to the linting rules before submitting any code changes / Pull Requests to Hinode’s repository.
Use the following command to test for any available upgrades of used packages. The command runs npx
to validate the dependencies and to upgrade the dependency versions in package.json
.
npm run upgrade
Be sure to install the upgraded dependencies if needed:
npm install