Run the docs locally
Edit on GitHubThis document describes how to run Spryker docs locally using Docker. You may want to run docs locally to preview your changes, but it’s not required for contributing.
For instructions on contributing, see Edit the docs locally
Prerequisites
- Create an account on GitHub.
- Install GitHub Desktop.
- Install Docker Desktop.
- Clone the Spryker docs repository. For detailed instructions, see Clone the Spryker docs repository.
Run the docs
- In Docker Desktop, click >_Terminal.
- In terminal, go to the
spryker-docsdirectory. If you didn’t change the default path when cloning the repository, the command to do it looks as follows:
cd Documents/GitHub/spryker-docs
- Run the docs:
docker compose up
The first launch can take up to 15 minutes. When the build is done, you should see a message that the server is running and its local address. You can access the local copy of Spryker docs by opening http://localhost:4000 in your browser. If you update a file in the repository, it will be automatically refreshed so you can see it on your local website.
Run only selected sections of the docs
The full site contains thousands of pages, so each build and rebuild takes minutes. If you work on pages in one section, you can build only that section. A build of one section takes seconds, and a rebuild after you save a file takes about one second.
A section is a top-level folder in the docs directory. The following sections are available:
| SECTION | CONTENT |
|---|---|
about |
About Spryker, release notes, support, and contribution guides |
ca |
Cloud administration |
dg |
Developer guides |
integrations |
Third-party integrations |
pbc |
Packaged Business Capabilities |
Prerequisites
In addition to the general prerequisites, install Node.js 18 or later. The npm command is included in Node.js.
Run the selected sections
- In a terminal, go to the
spryker-docsdirectory. - Run the
docs:servecommand and pass the section names after--:
npm run docs:serve -- {section}
Examples:
| COMMAND | RESULT |
|---|---|
npm run docs:serve -- pbc |
Builds only docs/pbc. |
npm run docs:serve -- pbc dg |
Builds docs/pbc and docs/dg. Separate several sections with spaces. |
npm run docs:serve |
Builds the full site. |
The -- separator passes the section names to the script instead of to npm. If you omit it, npm does not pass the section names, and the script builds the full site.
- When the terminal shows
Server running... press ctrl-c to stop., openhttp://localhost:4000in your browser. - To stop the server, press Ctrl+C in the terminal.
If you pass a section name that does not exist, the command stops and lists the available sections.
How the command works
The docs:serve command runs the _scripts/serve-docs.js script. The script does the following:
- Generates the
_config_dev.ymlfile. This file excludes all sections that you did not pass from the build. The file is ignored by Git, so do not edit or commit it. - If the selected sections differ from the previous run, deletes the
_sitefolder. This removes pages of previously built sections. - Starts the Jekyll server in the Docker container that
docker compose upuses.
Limitations
- Pages in excluded sections are not built. Links to these pages and their sidebar entries return a 404 error locally.
- Changes in the
_datafolder, such as sidebar files, are not detected while the server is running. To apply them, stop the server and run the command again. - Do not run
docker compose upandnpm run docs:serveat the same time. Both use ports 4000 and 35729.
Thank you!
For submitting the form