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
language: node_js | |
node_js: | |
- "node" | |
cache: | |
- yarn | |
install: | |
- yarn install | |
script: | |
- yarn build | |
deploy: |
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
import React, { Component } from 'react'; | |
+import { BrowserRouter, Link, Switch, Route } from 'react-router-dom'; | |
+import Home from './Home'; | |
+import Post from './Post'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
class App extends Component { | |
render() { | |
return ( |
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
$ create-react-app static-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
// Home.js | |
import React from 'react'; | |
class Home extends React.Component { | |
render() { | |
return <p>Home</p>; | |
} | |
} | |
export default Home; |
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
@mixin display-grid { | |
// single column by default at XS size | |
@include screen-from($bp-sm-min) { | |
display: grid; | |
@include grid-not-supported { | |
display: flex; | |
flex-wrap: wrap; | |
}; |
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
@mixin grid-not-supported { | |
// fallback with native feature detection | |
@supports not (display: grid) { | |
@content; | |
} | |
// fallback with Modernizr feature detection (IE) | |
.no-supports & { | |
@content; | |
} |
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { BrowserRouter } from 'react-router-dom'; | |
import App from './App'; | |
const root = document.getElementById('root'); | |
ReactDOM.render(<BrowserRouter><App /></BrowserRouter>, root); |
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
import React from 'react'; | |
import ReactDOMServer from 'react-dom/server'; | |
import { StaticRouter as Router } from 'react-router-dom'; | |
import App from './App'; | |
import HTML from './HTML'; | |
// static site generator | |
export default function render(locals, callback) { | |
const context = {}; |
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
const path = require('path'); | |
const webpack = require('webpack'); | |
const CopyWebpackPlugin = require('copy-webpack-plugin'); | |
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin'); | |
module.exports = { | |
entry: [path.resolve(__dirname, 'src')], | |
output: { |
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
const path = require('path'); | |
const webpack = require('webpack'); | |
const CopyWebpackPlugin = require('copy-webpack-plugin'); | |
module.exports = { | |
entry: { | |
bundle: path.resolve(__dirname, 'src', 'client.js'), | |
scripts: path.resolve(__dirname, 'src', 'scripts.js') | |
}, |