Gatsby Plugin

The Nx Plugin for Gatsby contains executors and generators for managing Gatsby applications and libraries within an Nx workspace. It provides:

  • Scaffolding for creating, building, serving, linting, and testing Gatsby applications.
  • Integration with building, serving, and exporting a Gatsby application.
  • Integration with React libraries within the workspace.

Installing the Gatsby Plugin

Installing the Gatsby plugin to a workspace can be done with the following:

yarn add -D @nrwl/gatsby
npm install -D @nrwl/gatsby

Applications

Generating new applications can be done with the following:

nx generate @nrwl/gatsby:application <name>

This creates the following app structure:

myorg/
├── apps/
│   ├── myapp/
│   │   ├── src/
│   │   │   ├── pages/
│   │   │   │   ├── index.module.css
│   │   │   │   └── index.tsx
│   │   ├── jest.conf.js
│   │   ├── tsconfig.json
│   │   ├── tsconfig.app.json
│   │   ├── tsconfig.spec.json
│   │   └── .eslintrc.json
│   └── myapp-e2e/
│   │   ├── src/
│   │   │   ├── integrations/
│   │   │   │   └── app.spec.ts
│   │   │   ├── fixtures/
│   │   │   ├── plugins/
│   │   │   └── support/
│   │   ├── cypress.json
│   │   ├── tsconfig.e2e.json
│   │   └── .eslintrc.json
├── libs/
├── workspace.json
├── nx.json
├── package.json
├── tools/
├── tsconfig.json
└── .eslintrc.json

See Also

Executors / Builders

  • build - Builds a Gatsby application
  • server - Builds and serves a Gatsby application

Generators