rickvanlieshout.com/gatsby-config.js
Vincent Taverna cae0ed4477 Update from node-sass to sass
To futureproof the usage of sass, moving to the Dart implementation instead of the older C one.
2021-01-02 13:07:45 -05:00

245 lines
6.4 KiB
JavaScript

'use strict';
const siteConfig = require('./config.js');
const postCssPlugins = require('./postcss-config.js');
module.exports = {
pathPrefix: siteConfig.pathPrefix,
siteMetadata: {
url: siteConfig.url,
title: siteConfig.title,
subtitle: siteConfig.subtitle,
copyright: siteConfig.copyright,
disqusShortname: siteConfig.disqusShortname,
menu: siteConfig.menu,
author: siteConfig.author
},
plugins: [
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/static`,
name: 'assets'
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/static/media`,
name: 'media'
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/content`,
name: 'pages'
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'css',
path: `${__dirname}/static/css`
}
},
{
resolve: 'gatsby-plugin-feed',
options: {
query: `
{
site {
siteMetadata {
site_url: url
title
description: subtitle
}
}
}
`,
feeds: [{
serialize: ({ query: { site, allMarkdownRemark } }) => (
allMarkdownRemark.edges.map((edge) => ({
...edge.node.frontmatter,
description: edge.node.frontmatter.description,
date: edge.node.frontmatter.date,
url: site.siteMetadata.site_url + edge.node.fields.slug,
guid: site.siteMetadata.site_url + edge.node.fields.slug,
custom_elements: [{ 'content:encoded': edge.node.html }]
}))
),
query: `
{
allMarkdownRemark(
limit: 1000,
sort: { order: DESC, fields: [frontmatter___date] },
filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) {
edges {
node {
html
fields {
slug
}
frontmatter {
title
date
template
draft
description
}
}
}
}
}
`,
output: '/rss.xml',
title: siteConfig.title
}]
}
},
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
'gatsby-remark-relative-images',
{
resolve: 'gatsby-remark-katex',
options: {
strict: 'ignore'
}
},
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 960,
withWebp: true
}
},
{
resolve: 'gatsby-remark-responsive-iframe',
options: { wrapperStyle: 'margin-bottom: 1.0725rem' }
},
'gatsby-remark-autolink-headers',
'gatsby-remark-prismjs',
'gatsby-remark-copy-linked-files',
'gatsby-remark-smartypants',
'gatsby-remark-external-links'
]
}
},
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
'gatsby-plugin-netlify',
{
resolve: 'gatsby-plugin-netlify-cms',
options: {
modulePath: `${__dirname}/src/cms/index.js`
}
},
{
resolve: 'gatsby-plugin-google-gtag',
options: {
trackingIds: [siteConfig.googleAnalyticsId],
pluginConfig: {
head: true
}
}
},
{
resolve: 'gatsby-plugin-sitemap',
options: {
query: `
{
site {
siteMetadata {
siteUrl: url
}
}
allSitePage(
filter: {
path: { regex: "/^(?!/404/|/404.html|/dev-404-page/)/" }
}
) {
edges {
node {
path
}
}
}
}
`,
output: '/sitemap.xml',
serialize: ({ site, allSitePage }) => allSitePage.edges.map((edge) => ({
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: 'daily',
priority: 0.7
}))
}
},
{
resolve: 'gatsby-plugin-manifest',
options: {
name: siteConfig.title,
short_name: siteConfig.title,
start_url: '/',
background_color: '#FFF',
theme_color: '#F7A046',
display: 'standalone',
icon: 'static/photo.jpg'
},
},
{
resolve: 'gatsby-plugin-offline',
options: {
workboxConfig: {
runtimeCaching: [{
// Use cacheFirst since these don't need to be revalidated (same RegExp
// and same reason as above)
urlPattern: /(\.js$|\.css$|[^:]static\/)/,
handler: 'CacheFirst',
},
{
// page-data.json files, static query results and app-data.json
// are not content hashed
urlPattern: /^https?:.*\/page-data\/.*\.json/,
handler: 'StaleWhileRevalidate',
},
{
// Add runtime caching of various other page resources
urlPattern: /^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/,
handler: 'StaleWhileRevalidate',
},
{
// Google Fonts CSS (doesn't end in .css so we need to specify it)
urlPattern: /^https?:\/\/fonts\.googleapis\.com\/css/,
handler: 'StaleWhileRevalidate',
},
],
},
},
},
'gatsby-plugin-catch-links',
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-plugin-sass',
options: {
implementation: require('sass'),
postCssPlugins: [...postCssPlugins],
cssLoaderOptions: {
camelCase: false
}
}
},
{
resolve: '@sentry/gatsby',
options: {
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1
}
},
'gatsby-plugin-flow',
'gatsby-plugin-optimize-svgs'
]
};