-
Setup.
Create environment files in the /gatsby directory called '
.env.production
' and '.env.development
' with the required variables from '.env.example
' and the environment variables values from Gatsby Cloud. For the development environment, SANITY_WATCHMODE can be set to true and other variables can be changed to use test environments. Ethereal Mail or another SMTP service can be used to create credentials passed via the MAIL variables.Install packages with '
yarn
'
-
Run.
Sanity
In the Sanity folder, run the back-end with:
'
yarn sanity start
'Content Studio can be found at http://localhost:3333
Storybook
In the Gatsby folder run storybook with:
'
yarn run storybook
'Storybook will run at http://localhost:6006/
Front-end
In the Gatsby folder, run the front-end with:
'
yarn run start
'The site will run at http://localhost:8888/ (with netlify-cli)
View the GraphQL at http://localhost:8000/\_\_graphql
To be able to access from your Network: '
yarn gatsby develop -H 0.0.0.0
'
-
Deploy.
Before deploying, please ensure that you test following with node version specified in the NODE_VERSION environment variable
In /Gatsby and /Sanity run '
yarn run lint --fix
' and resolve any issues that aren't fixed automaticallyIn /Gatsby run '
yarn run build
'In /Sanity run '
yarn sanity deploy build
'Changes to the Main branch will automatically be deployed to the following:
-
Preview: Gatsby Cloud - deploys published automatically
-
-
Configure.
Add packages with '
yarn add [package name] --save
' - for Netlify serverless functions ensure that packages are added within the folder for the specific function.Add media via Cloudinary
Add content via Contentful
Headless CMS via Sanity
Database via Firebase Cloud Firestore
Content is compiled when the site is built - exceptions to this are:
-
Sanity > Site Settings > Intro Text
-
Sanity > Site Settings > Featured Items
-
Cloudinary Content
Publishing/unpublishing Contentful content will trigger a rebuild on Netlify.
-