This file contains hidden or 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
const { renderToString } = require(`react-dom/server`) | |
exports.replaceRenderer = function replaceRenderer({ bodyComponent, replaceBodyHTMLString }) { | |
const bodyHTML = renderToString(bodyComponent) | |
// parse into document (and inject this into stencil SSR) | |
// call SSR APIs | |
// call replaceBodyHTMLString with hydrated HTML | |
} |
This file contains hidden or 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
import React from 'react' | |
export default class IndexPage extends React.Component { | |
// don't do this 😈 | |
componentDidMount() { | |
const node = document.getElementById('whatever') | |
node.style.color = 'blue' | |
} | |
render() { |
This file contains hidden or 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
{ | |
"data": { | |
"allMarkdownRemark": { | |
"edges": [ | |
{ | |
"node": { | |
"excerpt": "gatsby-plugin-page-creator Gatsby plugin that automatically creates pages from React components in specified directories. Gatsby\nincludes…", | |
"excerptAst": { | |
"type": "root", | |
"children": [ |
This file contains hidden or 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
import React from 'react' | |
import { StaticQuery, graphql } from 'gatsby' | |
export default function Bio() { | |
return ( | |
<StaticQuery | |
query={graphql` | |
{ | |
file({ relativePath: { regex: "/bio.md/" }}) { | |
childMarkdownRemark { |
This file contains hidden or 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
const { Helmet } = require('react-helmet') | |
const { onRenderBody } = require('gatsby/ssr') | |
onRenderBody(({ setHeadComponents, setHtmlAttributes, setBodyAttributes }) => { | |
const helmet = Helmet.renderStatic() | |
setHtmlAttributes(helmet.htmlAttributes.toComponent()) | |
setBodyAttributes(helmet.bodyAttributes.toComponent()) | |
setHeadComponents([ | |
helmet.title.toComponent(), | |
helmet.link.toComponent(), |
This file contains hidden or 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
const path = require('path') | |
const { createPages } = require('gatsby/node') | |
createPages(async ({ actions, graphql }) => { | |
const { createPage } = actions | |
const result = await graphql(` | |
{ | |
allMarkdownRemark { | |
edges { |
This file contains hidden or 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
import React from 'react' | |
import { wrapRootElement } from 'gatsby/browser' | |
wrapRootElement(({ element }) => ( | |
<div>{element}</div> | |
)) |
This file contains hidden or 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
import React, { Component } from 'react' | |
import fetch from 'isomorphic-fetch' | |
import Layout from '../components/layout' | |
export default class IndexPage extends Component { | |
state = { | |
data: [] | |
} |
This file contains hidden or 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
module.exports = { | |
plugins: [ | |
{ | |
resolve: 'gatsby-source-contentful', | |
options: { | |
spaceId: process.env.GATSBY_CONTENTFUL_SPACE_ID || process.your.CONTENTFUL_SPACE_ID, | |
accessToken: process.env.GATSBY_CONTENTFUL_ACCESS_TOKEN || process.env.CONTENTFUL_ACCESS_TOKEN, | |
host: process.env.GATSBY_CONTENTFUL_HOST || process.env.CONTENTFUL_HOST | |
} | |
} |
This file contains hidden or 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
#!/bin/bash | |
# shallow_clone local_folder example-name | |
## shallow_clone using-jest-example using-jest | |
fun shallow_clone () { | |
folder=$1 | |
example=$2 | |
mkdir $folder | |
cd $folder |