npx create-nx-workspace --cli=nx --preset=empty
# Using npm
npm install --save-dev @nrwl/gatsby
# Using yarn
yarn add -D @nrwl/gatsby
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.
npx nx serve <app-name> --open
In prod mode:
npx nx serve <app-name> --prod --open
npx nx build <app-name>
npx nx test <app-name>
npx nx lint <app-name>
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';
Visit the Nx Documentation to learn more.