Skip to content

Commit

Permalink
Initial Gatsby check-in
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Jun 30, 2017
1 parent d377e54 commit e5534d6
Show file tree
Hide file tree
Showing 25 changed files with 4,798 additions and 196 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"fbjs-scripts": "^0.6.0",
"filesize": "^3.5.6",
"flow-bin": "^0.48.0",
"gatsby": "next",
"git-branch": "^0.3.0",
"glob": "^6.0.4",
"glob-stream": "^6.1.0",
Expand Down
4 changes: 4 additions & 0 deletions www/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ['react', 'es2015', 'stage-1'],
"plugins": ['add-module-exports']
}
7 changes: 7 additions & 0 deletions www/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
public
.gatsby-context.js
.DS_Store
.intermediate-representation/
.cache/
yarn.lock
39 changes: 39 additions & 0 deletions www/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# back to language cpp to try to bypass osx node failure
language: cpp
sudo: false
env:
- export NODE_VERSION="0.10"
- export NODE_VERSION="0.12"
- export NODE_VERSION="4"
- export NODE_VERSION="5"
os:
- linux
- osx
# pre-install to bring in the correct version of node via nvm
before_install:
- git submodule update --init --recursive
- git clone https://github.com/creationix/nvm.git ./.nvm
- source ./.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- npm config set python `which python`
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CC="gcc-4.8";
export CXX="g++-4.8";
export LINK="gcc-4.8";
export LINKXX="g++-4.8";
fi
- gcc --version
- g++ --version
# node 4 depends on gcc 4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- gcc-4.8
# script needed to test, because defaults don't work on osx
script:
- npm install
- npm run lint
9 changes: 8 additions & 1 deletion www/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
This is the Gatsby site.
# gatsby-starter-blog
Gatsby starter for creating a blog

Install this starter (assuming Gatsby is installed) by running from your CLI:
`gatsby new gatsby-blog https://github.com/gatsbyjs/gatsby-starter-blog`

## Running in development
`gatsby develop`
46 changes: 46 additions & 0 deletions www/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = {
siteMetadata: {
title: "Gatsby Starter Blog",
author: "Kyle Mathews",
},
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/pages`,
name: "pages",
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-responsive-image`,
options: {
maxWidth: 590,
},
},
{
resolve: `gatsby-remark-responsive-iframe`,
options: {
wrapperStyle: `margin-bottom: 1.0725rem`,
},
},
"gatsby-remark-prismjs",
"gatsby-remark-copy-linked-files",
"gatsby-remark-smartypants",
],
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-google-analytics`,
options: {
//trackingId: `ADD YOUR TRACKING ID HERE`,
},
},
`gatsby-plugin-offline`,
],
}
73 changes: 73 additions & 0 deletions www/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
const _ = require("lodash")
const Promise = require("bluebird")
const path = require("path")
const select = require(`unist-util-select`)
const fs = require(`fs-extra`)

exports.createPages = ({ graphql, boundActionCreators }) => {
const { createPage } = boundActionCreators

return new Promise((resolve, reject) => {
const pages = []
const blogPost = path.resolve("./src/templates/blog-post.js")
resolve(
graphql(
`
{
allMarkdownRemark(limit: 1000) {
edges {
node {
fields {
slug
}
}
}
}
}
`
).then(result => {
if (result.errors) {
console.log(result.errors)
reject(result.errors)
}

// Create blog posts pages.
_.each(result.data.allMarkdownRemark.edges, edge => {
createPage({
path: edge.node.fields.slug, // required
component: blogPost,
context: {
slug: edge.node.fields.slug,
},
})
})
})
)
})
}

// Add custom slug for blog posts to both File and MarkdownRemark nodes.
exports.onCreateNode = ({ node, boundActionCreators, getNode }) => {
const { createNodeField } = boundActionCreators

switch (node.internal.type) {
case 'File':
const parsedFilePath = path.parse(node.relativePath)
const slug = `/${parsedFilePath.dir}/`
createNodeField({
node,
fieldName: 'slug',
fieldValue: slug
})
return

case 'MarkdownRemark':
const fileNode = getNode(node.parent)
createNodeField({
node,
fieldName: 'slug',
fieldValue: fileNode.fields.slug,
})
return
}
}
59 changes: 59 additions & 0 deletions www/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "gatsby-starter-blog",
"description": "Starter Gatsby Blog",
"version": "1.0.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby-starter-blog/issues"
},
"dependencies": {
"gatsby": "next",
"gatsby-link": "next",
"gatsby-transformer-remark": "next",
"gatsby-transformer-sharp": "next",
"gatsby-plugin-google-analytics": "next",
"gatsby-plugin-manifest": "next",
"gatsby-plugin-offline": "next",
"gatsby-plugin-preact": "next",
"gatsby-plugin-sharp": "next",
"gatsby-source-filesystem": "next",
"gatsby-remark-copy-linked-files": "next",
"gatsby-remark-prismjs": "next",
"gatsby-remark-responsive-iframe": "next",
"gatsby-remark-responsive-image": "next",
"gatsby-remark-smartypants": "next",
"lodash": "^4.15.0",
"moment": "^2.14.1",
"react-helmet": "^4.0.0",
"react-responsive-grid": "^0.3.3",
"react-typography": "^0.15.0",
"safe-access": "^0.1.0",
"typeface-merriweather": "^0.0.25",
"typeface-montserrat": "^0.0.24",
"typography": "^0.15.8",
"typography-theme-wordpress-2016": "^0.15.1",
"underscore.string": "^3.2.3"
},
"devDependencies": {
"gh-pages": "^0.12.0"
},
"homepage": "https://github.com/gatsbyjs/gatsby-starter-blog#readme",
"keywords": [
"gatsby"
],
"license": "MIT",
"main": "n/a",
"repository": {
"type": "git",
"url": "git+https://github.com/gatsbyjs/gatsby-starter-blog.git"
},
"scripts": {
"dev": "gatsby develop",
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public .",
"test": "echo \"Error: no test specified\" && exit 1",
"develop": "gatsby develop",
"build": "gatsby build",
"deploy": "gatsby build --prefix-links && gh-pages -d public",
"fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix gatsby-node.js"
}
}
43 changes: 43 additions & 0 deletions www/src/components/Bio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from "react"

// Import typefaces
import "typeface-montserrat"
import "typeface-merriweather"

import profilePic from "./profile-pic.jpg"
import { rhythm } from "../utils/typography"

class Bio extends React.Component {
render() {
return (
<p
style={{
marginBottom: rhythm(2.5),
}}
>
<img
src={profilePic}
alt={`Kyle Mathews`}
style={{
float: "left",
marginRight: rhythm(1 / 4),
marginBottom: 0,
width: rhythm(2),
height: rhythm(2),
}}
/>
Written by
{" "}
<strong>Kyle Mathews</strong>
{" "}
who lives and works in San Francisco building useful things.
{" "}
<a href="https://twitter.com/kylemathews">
You should follow him on Twitter
</a>
</p>
)
}
}

export default Bio
Binary file added www/src/components/profile-pic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion www/src/css/README.md

This file was deleted.

Loading

0 comments on commit e5534d6

Please sign in to comment.