/gatsby

Nx plugin for Gatsby

Primary LanguageTypeScriptMIT LicenseMIT

Gatsby Plugin for Nx

License NPM Version Join the chat at https://gitter.im/nrwl-nx/community Join us @nrwl/community on slack

Getting started

Create a new Nx workspace:

npx create-nx-workspace --cli=nx --preset=empty

Install Gatsby plugin

# Using npm
npm install --save-dev @nrwl/gatsby

# Using yarn
yarn add -D @nrwl/gatsby

Create an app

npx nx g @nrwl/gatsby:app <app-name>

When using Nx, you can create multiple applications and themes in the same workspace. If you don't want to prefix your commands with npx, install @nrwl/cli globally.

Serve the app

npx nx serve <app-name> --open

In prod mode:

npx nx serve <app-name> --prod --open

Build/test/lint the app

npx nx build <app-name>
npx nx test <app-name>
npx nx lint <app-name>

Using components from React library

You can use a component from React library generated using Nx package for React. Once you run:

npx nx g @nrwl/react:lib ui-button --style=css

This will generate the UiButton component, which you can use in your app.

import { UiButton } from '@myorg/ui-button';

Learn more

Visit the Nx Documentation to learn more.