Skip to content

Commit

Permalink
generate access tokens and add them to .env
Browse files Browse the repository at this point in the history
  • Loading branch information
mackenziekerwin committed Mar 7, 2022
1 parent aace413 commit 76eb662
Show file tree
Hide file tree
Showing 6 changed files with 3,299 additions and 183 deletions.
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GATSBY_PRISMIC_REPO_NAME=XXXXXXXXXXXXXX
PRISMIC_ACCESS_TOKEN=XXXXXXXXXXXXXX
PRISMIC_CUSTOM_TYPES_API_TOKEN=XXXXXXXXXXXXXX
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
.cache/
public
.env.development
.env.production
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ git clone [email protected]:Scout-NU/scout-presents-site.git
```bash
cd scout-presents-site
```

3. Set up environment variables

In the project directory is a file called `env_example`. This holds all of the necessary environment variables to create this project, including the Prismic access token.
In the project directory is a file called `.env.sample`. This holds all of the necessary environment variables to create this project, including the Prismic access token.

Copy the file and add the values to the variables.

```sh
cp env_example .env.development
```bash
cp .env.sample .env.development
```

```sh
# In .env
GATSBY_PRISMIC_REPO_NAME=XXXXXXXXXXXXXX
Expand All @@ -47,13 +49,15 @@ npm start
It will likely start on http://localhost:8000. When you make changes, the site will auto-refresh and display your changes.

### Updating the CMS

Thanks to Gatsby's intense caching, when updating any data in the Prismic CMS interface, you must do two things for the updated content to show up in your GraphQL queries:

1. **Publish the document on Prismic!** This won't affect any current builds of the marketing site, as all of the data is queried and cached on build of the site.

2. **Restart the development server!** Gatsby only grabs data from Prismic on build, so the server must be restarted to grab the new data.

### Deploying to Netlify

To update the site, it needs to be deployed to Netlify. This can happen in a number of ways:

**Manual Deploy** The Tech Director goes into Netlify and manually creates a new deploy.
Expand All @@ -70,7 +74,7 @@ A quick look at the top-level files and directories you'll see in a Gatsby proje
├── node_modules
├── src
├── .gitignore
├── env_example
├── .env.sample
├── gatsby-config.js
├── package.json
└── README.md
Expand All @@ -81,13 +85,13 @@ A quick look at the top-level files and directories you'll see in a Gatsby proje

3. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.

4. **`env_example`**: This file holds all of the necessary environment variables to create this project.
4. **`.env.sample`**: This file holds all of the necessary environment variables to create this project.

5. **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the [config docs](https://www.gatsbyjs.org/docs/gatsby-config/) for more detail).

6. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how yarn knows which packages to install for your project.
6. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how yarn knows which packages to install for your project.

7. **`README.md`**: A text file containing useful reference information about your project.
7. **`README.md`**: A text file containing useful reference information about your project.

## 🎓 Learning Gatsby

Expand Down
19 changes: 15 additions & 4 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
module.exports = {
siteMetadata: {
title: `new`,
siteUrl: `https://www.yourdomain.tld`
title: `new`,
siteUrl: `https://www.yourdomain.tld`,
},
plugins: ["gatsby-plugin-styled-components"]
};
plugins: [
'gatsby-plugin-styled-components',
'gatsby-plugin-image',
{
resolve: 'gatsby-source-prismic',
options: {
repositoryName: process.env.GATSBY_PRISMIC_REPO_NAME,
accessToken: process.env.PRISMIC_ACCESS_TOKEN,
customTypesApiToken: process.env.PRISMIC_CUSTOM_TYPES_API_TOKEN,
},
},
],
};
Loading

0 comments on commit 76eb662

Please sign in to comment.