Skip to content

Commit 20e1b46

Browse files
committed
add gatsby wrapper
1 parent 4cf4452 commit 20e1b46

21 files changed

+27300
-0
lines changed

Diff for: .prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"endOfLine": "lf",
3+
"semi": false,
4+
"singleQuote": false,
5+
"tabWidth": 2,
6+
"trailingComma": "es5"
7+
}

Diff for: gatsby-browser.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Implement Gatsby's Browser APIs in this file.
3+
*
4+
* See: https://www.gatsbyjs.org/docs/browser-apis/
5+
*/
6+
7+
// You can delete this file if you're not using it
8+
require("prismjs/themes/prism-solarizedlight.css");
9+
require("prismjs/plugins/line-numbers/prism-line-numbers.css");
10+
require('./src/styles/global.css')

Diff for: gatsby-config.js

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
module.exports = {
2+
siteMetadata: {
3+
title: `Gatsby Default Starter`,
4+
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
5+
author: `@gatsbyjs`,
6+
},
7+
plugins: [
8+
`gatsby-plugin-react-helmet`,
9+
{
10+
resolve: `gatsby-source-filesystem`,
11+
options: {
12+
name: `images`,
13+
path: `${__dirname}/src/images`,
14+
},
15+
},
16+
`gatsby-transformer-sharp`,
17+
`gatsby-plugin-sharp`,
18+
{
19+
resolve: `gatsby-source-filesystem`,
20+
options: {
21+
path: `${__dirname}/content`,
22+
name: "markdown-pages",
23+
},
24+
},
25+
`gatsby-transformer-remark`,
26+
{
27+
resolve: `gatsby-remark-prismjs`,
28+
options: {
29+
// Class prefix for <pre> tags containing syntax highlighting;
30+
// defaults to 'language-' (eg <pre class="language-js">).
31+
// If your site loads Prism into the browser at runtime,
32+
// (eg for use with libraries like react-live),
33+
// you may use this to prevent Prism from re-processing syntax.
34+
// This is an uncommon use-case though;
35+
// If you're unsure, it's best to use the default value.
36+
classPrefix: "language-",
37+
// This is used to allow setting a language for inline code
38+
// (i.e. single backticks) by creating a separator.
39+
// This separator is a string and will do no white-space
40+
// stripping.
41+
// A suggested value for English speakers is the non-ascii
42+
// character '›'.
43+
inlineCodeMarker: null,
44+
// This lets you set up language aliases. For example,
45+
// setting this to '{ sh: "bash" }' will let you use
46+
// the language "sh" which will highlight using the
47+
// bash highlighter.
48+
aliases: {},
49+
// This toggles the display of line numbers globally alongside the code.
50+
// To use it, add the following line in src/layouts/index.js
51+
// right after importing the prism color scheme:
52+
// `require("prismjs/plugins/line-numbers/prism-line-numbers.css");`
53+
// Defaults to false.
54+
// If you wish to only show line numbers on certain code blocks,
55+
// leave false and use the {numberLines: true} syntax below
56+
showLineNumbers: true,
57+
// If setting this to true, the parser won't handle and highlight inline
58+
// code used in markdown i.e. single backtick code like `this`.
59+
noInlineHighlight: false,
60+
},
61+
},
62+
{
63+
resolve: `gatsby-plugin-manifest`,
64+
options: {
65+
name: `gatsby-starter-default`,
66+
short_name: `starter`,
67+
start_url: `/`,
68+
background_color: `#663399`,
69+
theme_color: `#663399`,
70+
display: `minimal-ui`,
71+
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
72+
},
73+
},
74+
// this (optional) plugin enables Progressive Web App + Offline functionality
75+
// To learn more, visit: https://gatsby.dev/offline
76+
// 'gatsby-plugin-offline',
77+
],
78+
}

Diff for: gatsby-node.js

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/**
2+
* Implement Gatsby's Node APIs in this file.
3+
*
4+
* See: https://www.gatsbyjs.org/docs/node-apis/
5+
*/
6+
7+
// You can delete this file if you're not using it
8+
const path = require("path")
9+
const {
10+
createFilePath
11+
} = require(`gatsby-source-filesystem`)
12+
13+
exports.onCreateNode = ({
14+
node,
15+
getNode,
16+
actions
17+
}) => {
18+
const {
19+
createNodeField
20+
} = actions
21+
// Ensures we are processing only markdown files
22+
if (node.internal.type === "MarkdownRemark") {
23+
// Use `createFilePath` to turn markdown files in our `data/faqs` directory into `/faqs/slug`
24+
const relativeFilePath = createFilePath({
25+
node,
26+
getNode,
27+
basePath: "content/",
28+
})
29+
30+
// Creates new query'able field with name of 'slug'
31+
createNodeField({
32+
node,
33+
name: "slug",
34+
value: `${relativeFilePath}`,
35+
})
36+
}
37+
}
38+
39+
exports.createPages = ({
40+
actions,
41+
graphql
42+
}) => {
43+
const {
44+
createPage
45+
} = actions
46+
47+
const blogPostTemplate = path.resolve(`src/templates/quickStartTemplate.js`)
48+
49+
return graphql(`
50+
{
51+
allMarkdownRemark {
52+
edges {
53+
node {
54+
frontmatter {
55+
path
56+
}
57+
fields {
58+
slug
59+
}
60+
}
61+
}
62+
}
63+
}
64+
`).then(result => {
65+
if (result.errors) {
66+
return Promise.reject(result.errors)
67+
}
68+
69+
result.data.allMarkdownRemark.edges.forEach(({
70+
node
71+
}) => {
72+
createPage({
73+
path: node.fields.slug,
74+
component: blogPostTemplate,
75+
context: {}, // additional data can be passed via context
76+
})
77+
})
78+
})
79+
}

Diff for: gatsby-ssr.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
3+
*
4+
* See: https://www.gatsbyjs.org/docs/ssr-apis/
5+
*/
6+
7+
// You can delete this file if you're not using it

0 commit comments

Comments
 (0)