Guide to Writing Documentation
When developing documentation, there are steps to take before submitting a pull request
- Writing your documentation with hot reloading live in your browser
- Verifying your changes with a production build to ensure Hugo will minify everything correctly
Development with Hot Reloading
This method performs the following from the django-DefectDojo/docs directory:
- Remove any existing packages to perform a fresh install each time:
rm -rf public node_modules - Install all packages:
npm install - Start the server:
npm run dev - Access the site in the browser at http://localhost:1313
Execution List
rm -rf public node_modules npm install npm run dev
or for a one liner:
rm -rf public node_modules && \ npm install && \ npm run dev
Mimic Production Environment
This method performs the following from the django-DefectDojo/docs directory:
- Remove any existing packages to perform a fresh install each time:
rm -rf public node_modules - Install all packages in CI mode to only install from
package-lock.json:npm ci - Run Hugo to build the site in the way the CI job does, but in development environment to point at
localhostfor integrity checks :npm run build -- --environment development - Change directory to the new
publicdirectory to run the site locally:cd public - Run a light weight webserver to server the files, and access the site at http://localhost:8080:
python3 -m http.server 8080 - After killing the webserver process, navigate back to the
django-DefectDojo/docsdirectory:cd ../
Execution List
rm -rf public node_modules npm ci npm run build -- --environment development cd public python3 -m http.server 8080 cd ../
or for a one liner:
rm -rf public node_modules && \ npm ci && \ npm run build -- --environment development && \ cd public && \ python3 -m http.server 8080 && \ cd ../