-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit for conversion to Gatsby
As of this commit, you can't run this locally as it's relying on not yet released changes to Gatsby. I've published the site however to https://webpack-gatsby.netlify.com/
- Loading branch information
1 parent
a74db29
commit e8ff05c
Showing
83 changed files
with
585 additions
and
357 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
{ | ||
"presets": [ | ||
"es2015", | ||
"react" | ||
] | ||
"presets": ['es2015', 'stage-1', 'react'], | ||
} |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import React from 'react'; | ||
import { rhythm } from 'utilities/typography' | ||
|
||
export default props => { | ||
let { className = '' } = props; | ||
|
||
export default ({ className, style, children }) => { | ||
if (!className) { | ||
className = '' | ||
} | ||
return ( | ||
<div className={ `container ${className}`}> | ||
{ props.children } | ||
<div | ||
className={ `container ${className}`} | ||
style={{ | ||
padding: `${rhythm(1/2)} ${rhythm(1)}`, | ||
...style, | ||
}} | ||
> | ||
{ children } | ||
</div> | ||
); | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
import React from 'react'; | ||
|
||
export default props => { | ||
return ( | ||
<div className="contributors"> | ||
<h4>Contributors:</h4> | ||
<div className="contributors__list"> | ||
{ | ||
(props.contributors || []).map(contributor => ( | ||
<a key={ contributor } | ||
className="contributors__person" | ||
href={ `https://github.com/${contributor}` }> | ||
<img src={ `https://github.com/${contributor}.png?size=80` } /> | ||
<span>{ contributor }</span> | ||
</a> | ||
)) | ||
} | ||
if (props.contributors) { | ||
return ( | ||
<div className="contributors"> | ||
<hr /> | ||
<h4>Contributors:</h4> | ||
<div className="contributors__list"> | ||
{ | ||
(props.contributors || []).map(contributor => ( | ||
<a key={ contributor } | ||
className="contributors__person" | ||
href={ `https://github.com/${contributor}` }> | ||
<img src={ `https://github.com/${contributor}.png?size=80` } /> | ||
<span>{ contributor }</span> | ||
</a> | ||
)) | ||
} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
); | ||
} else { | ||
return null | ||
} | ||
}; |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const config = { | ||
siteMetadata: { | ||
title: 'Webpack', | ||
}, | ||
sources: `${__dirname}/pages/`, | ||
} | ||
|
||
export default config |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import _ from 'lodash' | ||
import path from 'path' | ||
// Have to make requires explicit so use same copy of plugin as Gatsby itself... | ||
var ExtractTextPlugin = require('gatsby/node_modules/extract-text-webpack-plugin'); | ||
|
||
exports.createPages = ({ graphql }) => ( | ||
new Promise((resolve, reject) => { | ||
const paths = [] | ||
graphql(` | ||
{ | ||
allMarkdown(first: 1000) { | ||
edges { | ||
node { | ||
path | ||
} | ||
} | ||
} | ||
} | ||
`) | ||
.then((result) => { | ||
if (result.errors) { | ||
console.log(result.errors) | ||
reject(result.errors) | ||
} | ||
|
||
const articleComponent = path.resolve('./page-templates/markdown-template.js') | ||
// Create article routes. | ||
_.each(result.data.allMarkdown.edges, (edge) => { | ||
paths.push({ | ||
path: edge.node.path, // required | ||
component: articleComponent, | ||
}) | ||
}) | ||
|
||
resolve(paths) | ||
}) | ||
}) | ||
) | ||
|
||
exports.modifyWebpackConfig = function(config, env) { | ||
console.log(env) | ||
// Use style-loader for dev. | ||
if (env === 'develop') { | ||
config.loader('sass', { | ||
test: /\.(sass|scss)/, | ||
loaders: ['style', 'css', 'sass'], | ||
}) | ||
// Add ExtractTextPlugin loader when building css. | ||
} else if (env === 'build-css') { | ||
config.loader('sass', { | ||
test: /\.(sass|scss)$/, | ||
loader: ExtractTextPlugin.extract(['css?minimize', 'postcss', 'sass']), | ||
}) | ||
// Otherwise use a null-loader. | ||
} else { | ||
config.loader('sass', { | ||
test: /\.(sass|scss)/, | ||
loader: 'null', | ||
}) | ||
} | ||
|
||
return config | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react' | ||
|
||
import HTMLScripts from 'html-scripts' | ||
import HTMLStyles from 'html-styles' | ||
import { GoogleFont, TypographyStyle } from 'react-typography' | ||
import typography from './utilities/typography' | ||
import get from 'lodash/get' | ||
|
||
module.exports = React.createClass({ | ||
render () { | ||
// TODO add react helmet rewind | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<title>Webpack</title> | ||
<meta charSet="utf-8" /> | ||
<meta httpEquiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0" | ||
/> | ||
<GoogleFont typography={typography} /> | ||
<TypographyStyle typography={typography} /> | ||
<HTMLStyles /> | ||
{this.props.headComponents} | ||
</head> | ||
<body> | ||
<div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} /> | ||
<HTMLScripts scripts={this.props.scripts} /> | ||
</body> | ||
</html> | ||
) | ||
}, | ||
}) |
Oops, something went wrong.