Skip to content

all-purpose/ap-website-v3

Repository files navigation

AP Website

💻 Install locally

Node.js 18.x.

  1. Clone the repo to local folder

  2. Yarn (v1) is used to manage the project dependencies. If you don’t have Yarn installed, run:

npm install yarn -g
  1. Run yarn install to install the project dependencies

Note: Gatsby CLI is needed to run the Gatsby development/build commands. It’s included in the package.json file.

  1. Create .env.development and .env.production files in the root of the project. These will hold the environment variables for the Prismic CMS integration. Contact a AP Website team member to get the content of these files.

🏗 Development

Build and server

  1. Run gatsby develop

  2. After building, a hot reload server is started automatically. Browse to http://localhost:8000 to view the development site. Each subsequent save in the code editor will re-load the dev site.

GraphQL editor

Running the development build will also start the visual GraphiQL tool which you can use to build GraphQL queries and then copy and paste into the code.

In a browser go to http://localhost:8000/___graphql to open the GraphiQL editor.

Caching and Prismic CMS data

If you made changes in Prismic you will likely need to clear the cache in Gatsby so that the new data is pulled in.

Run gatsby clean && gatsby develop to clear the cache (deletes the .cache folder) and restart the dev build/server.

Note: You will only need to run gatsby clean when new data has come in.

🚀 Running a local production build

It’s useful to build an optimized production version of the site locally to ensure the site builds and works as expected before deploying it live.

  1. Run gatsby build && gatsby serve to build an optimized production version locally. The gatsby serve command will start a local server.

  2. Open a browser and go to http://localhost:9000 to view the production-optimized version of the site.

Gatsby-specific files

(From Gatsby starter README)

gatsby-browser.js: This file is where Gatsby expects to find any usage of the Gatsby browser APIs (if any). These allow customization/extension of default Gatsby settings affecting the browser.

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 for more detail).

gatsby-node.js: This file is where Gatsby expects to find any usage of the Gatsby Node APIs (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.

gatsby-ssr.js: This file is where Gatsby expects to find any usage of the Gatsby server-side rendering APIs (if any). These allow customization of default Gatsby settings affecting server-side rendering.

📚 Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •