Created
November 20, 2019 21:59
-
-
Save horacioh/e798d664d812b1d770a53a4eecc958aa to your computer and use it in GitHub Desktop.
Gatsby config: PostCSS, Tailwind, Emotion, Prismic, Google Analytics, Manifest & Offline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable jsx-a11y/rule-name */ | |
const path = require("path") | |
require("dotenv").config({ | |
path: `../.env.${process.env.NODE_ENV}`, | |
}) | |
module.exports = { | |
siteMetadata: { | |
siteUrl: `https://example.com`, | |
} | |
plugins: [ | |
`gatsby-plugin-emotion`, | |
`gatsby-transformer-sharp`, | |
`gatsby-plugin-sharp`, | |
`gatsby-plugin-react-helmet`, | |
`gatsby-plugin-sitemap`, | |
`gatsby-plugin-netlify`, | |
`gatsby-plugin-catch-links`, | |
{ | |
resolve: `gatsby-plugin-postcss`, | |
options: { | |
postCssPlugins: [ | |
require("tailwindcss")("./tailwind.config.js"), | |
require("autoprefixer")], | |
}, | |
}, | |
{ | |
resolve: `gatsby-plugin-purgecss`, | |
options: { | |
printRejected: true, // Print removed selectors and processed file names | |
// develop: true, // Enable while using `gatsby develop` | |
tailwind: true, // Enable tailwindcss support | |
// whitelist: ['whitelist'], // Don't remove this selector | |
// ignore: ['/ignored.css', 'prismjs/', 'docsearch.js/'], // Ignore files/folders | |
// purgeOnly : ['components/', '/main.css', 'bootstrap/'], // Purge only these files/folders | |
} | |
} | |
{ | |
resolve: `gatsby-source-filesystem`, | |
options: { | |
name: `images`, | |
path: path.join(__dirname, `src`, `assets`), | |
}, | |
}, | |
{ | |
resolve: `gatsby-source-prismic`, | |
options: { | |
repositoryName: `${process.env.PRISMIC_REPOSITORY_NAME}`, | |
accessToken: `${process.env.PRISMIC_API_KEY}`, | |
linkResolver: ({ node, key, value }) => post => `/${post.uid}`, | |
}, | |
}, | |
{ | |
resolve: `gatsby-plugin-google-analytics`, | |
options: { | |
// The property ID; the tracking code won't be generated without it | |
trackingId: "ANALYTICS_CODE_HERE", | |
// Defines where to place the tracking script - `true` in the head and `false` in the body | |
head: false, | |
// Setting this parameter is optional | |
// anonymize: true, | |
// Setting this parameter is also optional | |
respectDNT: true, | |
// Avoids sending pageview hits from custom paths | |
// exclude: ["/preview/**", "/do-not-track/me/too/"], | |
// Delays sending pageview hits on route update (in milliseconds) | |
pageTransitionDelay: 0, | |
// Enables Google Optimize using your container Id | |
// optimizeId: "YOUR_GOOGLE_OPTIMIZE_TRACKING_ID", | |
// Enables Google Optimize Experiment ID | |
// experimentId: "YOUR_GOOGLE_EXPERIMENT_ID", | |
// Set Variation ID. 0 for original 1,2,3.... | |
// variationId: "YOUR_GOOGLE_OPTIMIZE_VARIATION_ID", | |
// Any additional optional fields | |
// sampleRate: 5, | |
// siteSpeedSampleRate: 10, | |
// cookieDomain: "example.com", | |
}, | |
}, | |
{ | |
resolve: `gatsby-plugin-manifest`, | |
options: { | |
name: `Agilogy`, | |
icon: `src/assets/icon.png`, | |
short_name: `Agilogy`, | |
start_url: `/`, | |
background_color: `#3D3D3D`, | |
theme_color: `#FF9901`, | |
display: `standalone`, | |
}, | |
}, | |
{ | |
resolve: `gatsby-plugin-offline`, | |
options: { | |
precachePages: [`/services/*`, `/business-cases/*`, `/join-us/`], | |
}, | |
}, | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment