This example uses levimykel's Simple Sapper & Prismic example site starter, but pulls in content from Prismic's Gatsby Step by Step Tutorial site.
To create your new Prismic repository, follow the Launch the project instructions. Once you've installed the Prismic CLI and logged in, you can create your new Prismic repo as follows:
prismic theme https://github.com/prismicio/gatsby-getting-started-tutorial --ignore-conf
If it asks you for the URL of your theme, type:
https://github.com/prismicio/gatsby-getting-started-tutorial
Name your repository and choose the default Local folder to initialize your project. The local folder will contain a Gatsby starter, but since we're using Sapper, you can discard it.
Now download the Sapper project code from this repo.
npx degit briansteeleca/prismic-sapper-gatsby-tutorial my-prismic-app
Now change into the project directory:
cd my-prismic-app
In the root of your project, create a file named.env
. Add the environment variable PRISMIC_ENDPOINT
equal to your Prismic repo URL. For example, if your new Prismic repo is named 'my-new-prismic-repo', your .env
file should look like this:
PRISMIC_ENDPOINT=https://my-new-prismic-repo.prismic.io/api/v2
Then install the dependencies and run the project in development mode with:
npm install
npm run dev
This will a local server at localhost:3000 where you can see the site in action.
Note: Rather than using scoped CSS, this example dumps all of the CSS from Prismic's Gatsby tutorial site in global.css!