Build Documentation
Prerequisites
Before starting, ensure your environment is properly set up:
-
Install Node.js
Use tools like fnm or nvm for Node.js version management. -
Install pnpm
Follow the instructions at pnpm.io.
Verify Installation
Run the following commands to confirm the setup:
-
Check Node.js Version
node -v
Ensure the installed Node.js version matches the one in.nvmrc
. -
Check pnpm Version
pnpm -v
Verify that pnpm is installed and accessible.
Local Development
pnpm install
- to install dependenciespnpm start
- to start development server
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
Build
pnpm install
- to install dependencies for buildingBASE_URL="/prefix/docs/" URL="http://localhost" pnpm build
Parameter Descriptions
-
BASE_URL
Specifies the base path for the application (e.g.,/prefix/v2
).- Ensure the path starts with a
/
. - Do not include a trailing
/
.
- Ensure the path starts with a
-
URL
The directory where static files will be output. This command generates static content into thebuild
directory and can be served using any static contents hosting service.
Example Command
BASE_URL="/prefix/docs/" URL="http://example.com" pnpm build
For documentation hosted at http://example.com/prefix/docs