Install the Documentation Site Locally

💡

Advanced: this documentation is written for macOS and assumed basic knowledge of terminal and git commands. For users looking to add or edit documentation, please refer to Add, Edit & Publish Documentation for more information.

The NHMLA Developer Documentation uses Nextra Docs Theme (opens in a new tab), a static site generator. The steps on this page will walk through how to properly download the site and its dependencies for local development.

Install Git and Node

Git

If you haven't installed git already please resort to the following guide.

Git installation guide: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git (opens in a new tab)

Node

You will need node that is an npm package manager or similar toolset for downloading dependent packages.

To download node, we suggest you download nvm Node Version Manager. To check if you already have nvm installed run nvm -v to see what version you may have. To install nvm, run the following cURL command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

Once installed, reload your terminal by closing out current shell and opening a new shell.

Install latest Node version by running nvm install latest.

Clone GitHub repository

  1. Navigate where you'd like the documentation repository to be stored on your machine in Terminal

    cd /parent/directory/path
  2. Clone documentation repository

    git clone https://github.com/naturalhistorymuseumofla/nextra-docs.git

    You should have a directory of the docuementation code and an initialized git project.

Download packages using npm

Once you've cloned and opened the project locally, go to the root directory of the project. Then in your terminal use npm to install all dependencies. Remember, your terminal needs to be located at the root of the nextra-docs folder.

npm install

Start project

Start a local server to run the documentation site.

npm run dev

To stop the local server, press control + c key together to exit the server.

Anytime you make changes, the local server will hot reload to reflect your changes. If you have created new directories, and you don't see the changes right away, try building first, and running the dev server again.

npm run build