Skip to content

Instantly share code, notes, and snippets.

@MichaelCurrin
Last active September 1, 2020 19:00
Show Gist options
  • Save MichaelCurrin/4c8060dcc9d8841f842eeebc7a1436d8 to your computer and use it in GitHub Desktop.
Save MichaelCurrin/4c8060dcc9d8841f842eeebc7a1436d8 to your computer and use it in GitHub Desktop.
Serve a docs site locally with DocsifyJS

Serve a docs site locally with DocsifyJS

Choose an option below depending on whether you want to install and run Docsify CLI (optional), or use another server. Either way, you serve the docs directory.

Docsify CLI
  1. Install NodeJS.
  2. Install Docsify CLI
    • Global, or
      npm install docsify-cli --global
    • Project level.
      npm init
      npm install docsify-cli
      Add to package.json:
      "scripts": {
          "start": "docsify serve docs"
      }
  3. Run
    • Global.
      docsify serve docs
    • Project level.
      npm start
Python web server

This approach works without Docsify CLI.

The main draw backs are no hot-reload of the browser on file changes and you need to open the browser console and disable cache, to ensure you get the latest content.

  1. Install Python 3.
  2. Run
    (cd docs && python3 -m http.server 3000)
Other

Pick another web server quickstart from this gist.

Or use VS Code's Live Server - this may take configuration to ensure you serve from docs and not root, otherwise your links will break.

Then open in the browser:

Note: DocsifyJS provides a convenient but optional CLI. It helps you create and serve a DocsifyJS project. In particular, it provides hot-reloading by default when using the server so that an an open localhost webpage will refresh when project files are saved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment