Preview changes locally
Fern offers two ways to preview changes to your documentation: a local development environment and unique preview links.
Local development
Fern allows you to view changes to your documentation in a locally-hosted environment.
Follow these steps to install and run the Fern CLI:
Step 1: Install the Fern CLI:
Step 2: Navigate to the docs directory (where the fern
folder is located) and execute the following command:
A local preview of your documentation will be available at http://localhost:3000
. The functionality is available offline if you have run local development mode online at least once.
Some features (e.g. search) are disabled in the local development environment, including:
- Search
- SEO (favicon, auto-generated meta tags, etc.)
- Authentication
Custom ports
By default, Fern uses port 3000. You can customize the port Fern runs on by using the --port
flag. For example, to run Fern on port 3002,
use this command:
If you attempt to run Fern on a port that’s already in use, it will use the next available port:
Generate a preview link
Fern allows you to generate a shareable preview link displaying the current state of your docs. Each preview link is appended with a UUID and is not indexed. Currently, these links do not expire (this behavior is subject to change in the future).
Usage:
Example: