Anthony Moreira's blog
Install npm and gatsby cli
$ git clone git@github.com:contentful-userland/gatsby-contentful-starter.git
$ yarn install
Or use the Gatsby CLI.
$ gatsby new contentful-starter https://github.com/contentful-userland/gatsby-contentful-starter
This project comes with a Contentful setup command yarn run setup
.
This command will ask you for a space ID, and access tokens for the Contentful Management and Delivery API and then import the needed content model into the space you define and write a config file (./contentful.json
).
yarn run setup
automates that for you but if you want to do it yourself rename .contentful.json.sample
to .contentful.json
and add your configuration in this file.
This project comes with a few handy commands for linting and code fixing. The most important ones are the ones to develop and ship code. You can find the most important commands below.
npm run dev
Run in the project locally.
npm run build
Run a production build into ./public
. The result is ready to be put on any static hosting you prefer.
npm run deploy
Run a production build into ./public
and publish the site to GitHub pages.
npm run cleanup-repository
Removes all dependencies, scripts and data from the installation script.