Deploying Gatsby Website

Gatsby is a blazing fast modern site generator for React. This guide explains how to deploy your Gatsby website to Clodui.

Steps

  1. Create a website by following the steps explained here

  2. Make sure SPA mode is enabled for your Clodui website as described in settings section

  3. Open the terminal and navigate to your Gatsby website directory. Add Clodui CLI to your project by running following command.

    npm install @clodui/cli --save-dev
  4. Add a new NPM script to your package.json with the name deploy like below

    "scripts": {
        "deploy": "clodui deploy create --website-id <Clodui website id> --source-dir ./public",
        ....
    }

    Note: update --source-dir argument accordingly if Gatsby website is generated not under public directory.

  5. Clodui CLI command requires credentials. So set CLODUI_USERNAME and CLODUI_PASSWORD environment variables before running NPM script deploy. Like below

    CLODUI_USERNAME=<Username> CLODUI_PASSWORD=<Password> npm run deploy

We use cookies to offer you a better experience and analyze site traffic. By continuing to use this website, you consent to the use of our cookies.