doc.silverstripe.org/gatsby-config.js

132 lines
3.8 KiB
JavaScript
Raw Normal View History

2019-11-14 23:40:23 +01:00
const path = require('path');
2019-11-08 03:40:20 +01:00
module.exports = {
siteMetadata: {
2019-11-15 04:04:03 +01:00
title: `Silverstripe CMS Documentation`,
description: `Developer documentation for the Silverstripe CMS and framework.`,
2019-11-14 00:27:55 +01:00
author: `The Silverstripe Community`,
siteUrl: `https://doc.silverstripe.org`,
2019-11-08 03:40:20 +01:00
},
plugins: [
`gatsby-plugin-react-helmet`,
`gatsby-plugin-sass`,
`gatsby-plugin-sharp`,
2019-11-14 00:27:55 +01:00
`gatsby-plugin-sitemap`,
2019-11-08 03:40:20 +01:00
{
resolve: `gatsby-source-git`,
options: {
name: `4`,
remote: `/Users/acarlino/Sites/gatsby-docs-4`,
2019-11-18 05:59:10 +01:00
branch: `4`,
2019-11-08 03:40:20 +01:00
patterns: `docs/en/**`
}
},
2019-11-12 04:09:29 +01:00
{
resolve: `gatsby-source-git`,
options: {
name: `3`,
2019-11-18 05:59:10 +01:00
remote: `https://github.com/silverstripe/silverstripe-framework.git`,
2019-11-19 02:16:21 +01:00
branch: `3.7`,
2019-11-12 04:09:29 +01:00
patterns: `docs/en/**`
}
},
2019-11-18 05:51:57 +01:00
{
resolve: `gatsby-source-filesystem`,
options: {
2019-11-19 01:55:33 +01:00
name: `watcher--ss3`,
path: `${__dirname}/.cache/gatsby-source-git/3/docs/en`
2019-11-18 05:51:57 +01:00
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
2019-11-19 01:55:33 +01:00
name: `watcher--ss4`,
path: `${__dirname}/.cache/gatsby-source-git/4/docs/en`
2019-11-18 05:51:57 +01:00
}
},
2019-11-08 03:40:20 +01:00
{
resolve: 'gatsby-transformer-remark',
options: {
pedantic: false,
2019-11-08 03:40:20 +01:00
plugins: [
2019-11-14 23:40:23 +01:00
{
resolve: `gatsby-remark-prismjs`,
options: {
aliases: {
2019-11-18 05:51:57 +01:00
ss: `html`,
sh: `bash`,
2019-11-14 23:40:23 +01:00
}
}
},
`gatsby-remark-copy-linked-files`,
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 850,
},
},
2019-11-08 03:40:20 +01:00
]
}
},
`gatsby-plugin-typescript`,
{
resolve: `gatsby-plugin-styled-components`,
options: {
// Add any options here
},
2019-11-08 04:53:25 +01:00
},
{
resolve: `gatsby-plugin-purgecss`,
options: {
2019-11-15 04:04:03 +01:00
printRejected: false,
whitelist: ['algolia-autocomplete', 'pre', 'code'],
2019-11-08 11:47:42 +01:00
ignore: ['prismjs/','docsearch.js/', 'src/theme/assets/search/algolia.css'],
2019-11-14 23:40:23 +01:00
content: [
// All the markdown in the git repos
2019-11-14 23:40:23 +01:00
path.join(process.cwd(), '.cache/gatsby-source-git/**/*.md'),
// Components
2019-11-15 04:04:03 +01:00
path.join(process.cwd(), 'src/components/!(*.d).{ts,js,jsx,tsx}'),
// Static pages (e.g. 404)
2019-11-15 04:04:03 +01:00
path.join(process.cwd(), 'src/pages/!(*.d).{ts,js,jsx,tsx}'),
// Page templates
2019-11-15 04:04:03 +01:00
path.join(process.cwd(), 'src/templates/!(*.d).{ts,js,jsx,tsx}'),
2019-11-14 23:40:23 +01:00
],
2019-11-15 04:04:03 +01:00
extractors: [
2019-11-14 23:40:23 +01:00
{
// Simple extractor just matches against components and templates (e.g. JSX)
2019-11-14 23:40:23 +01:00
extractor: class {
static extract(content) {
return content.match(/[A-Za-z0-9-_:\/]+/g) || [];
}
},
2019-11-15 04:04:03 +01:00
extensions: ['js', 'ts', 'jsx', 'tsx']
2019-11-14 23:40:23 +01:00
},
{
// Match markdown files for icon classes (icon, iconBrand). Add each one to the
// allowed selectors defined in FontAwesome. Everything else in FA should be removed.
2019-11-14 23:40:23 +01:00
extractor: class {
static extract(content) {
const selectors = [`file-alt`]
const matches = content.match(/icon(Brand)?: ([a-zA-Z0-9_-]+)/);
if (matches) {
const isBrand = typeof matches[1] !== 'undefined';
selectors.push(isBrand ? `fab` : `fas`);
selectors.push(`fa-${matches[2]}`);
}
return selectors;
}
},
extensions: ['md']
},
]
},
2019-11-14 04:09:30 +01:00
},
{
resolve: `gatsby-plugin-offline`,
options: {
2019-11-14 23:40:23 +01:00
precachePages: [`/en/4/developer_guides/**`],
2019-11-14 04:09:30 +01:00
},
}
2019-11-08 03:40:20 +01:00
],
}