Skip to content

Commit

Permalink
Glorious initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gdborton committed Nov 3, 2017
0 parents commit 71702db
Show file tree
Hide file tree
Showing 22 changed files with 1,291 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": [["airbnb", { "modules": false }]],
"plugins": ["syntax-dynamic-import"]
}
15 changes: 15 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": ["airbnb"],
"parser": "babel-eslint",
"root": true,
"rules": {
"react/prop-types": 0,
"jsx-a11y/label-has-for": 0,
"react/no-find-dom-node": 0,
"react/no-string-refs": 0,
"jsx-a11y/no-autofocus": 0,
"jsx-a11y/anchor-is-valid": [2, {
"specialLink": [ "to" ]
}]
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Code Splitting + SSR with RRv4 demo

This is a demo repository set up to demo code splitting by route on React Router v4 with server rendered React components.

Running the demo:

```
git clone [email protected]:gdborton/rrv4-ssr-and-code-splitting.git
cd rrv4-ssr-and-code-splitting/
npm install
webpack
node server
open http://localhost:3000
```

## Things of note:
- The contents of this repo were based on the [TodoMVC code](https://github.com/tastejs/todomvc/tree/master/examples/react) originally written by [Pete Hunt](https://github.com/petehunt).
- We're using babel-eslint to enable `import()`.
- We're using the Airbnb dynamic import plugins, webpack's `import()` creates references to `window` that don't work in node:
- [babel-plugin-dynamic-import-webpack](https://github.com/airbnb/babel-plugin-dynamic-import-webpack) for client side code.
- [babel-plugin-dynamic-import-node](https://github.com/airbnb/babel-plugin-dynamic-import-node) for server side code.
- We have two webpack configs:
- One for server (`libraryTarget = commonjs2` and `babel-plugin-dynamic-import-node`).
- Another for client (`babel-plugin-dynamic-import-webpack`).
- The server, starts with some static data, **and is never updated**, you'll lose your changes if you reload the page.
141 changes: 141 additions & 0 deletions css/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
hr {
margin: 20px 0;
border: 0;
border-top: 1px dashed #c5c5c5;
border-bottom: 1px dashed #f7f7f7;
}

.learn a {
font-weight: normal;
text-decoration: none;
color: #b83f45;
}

.learn a:hover {
text-decoration: underline;
color: #787e7e;
}

.learn h3,
.learn h4,
.learn h5 {
margin: 10px 0;
font-weight: 500;
line-height: 1.2;
color: #000;
}

.learn h3 {
font-size: 24px;
}

.learn h4 {
font-size: 18px;
}

.learn h5 {
margin-bottom: 0;
font-size: 14px;
}

.learn ul {
padding: 0;
margin: 0 0 30px 25px;
}

.learn li {
line-height: 20px;
}

.learn p {
font-size: 15px;
font-weight: 300;
line-height: 1.3;
margin-top: 0;
margin-bottom: 0;
}

#issue-count {
display: none;
}

.quote {
border: none;
margin: 20px 0 60px 0;
}

.quote p {
font-style: italic;
}

.quote p:before {
content: '“';
font-size: 50px;
opacity: .15;
position: absolute;
top: -20px;
left: 3px;
}

.quote p:after {
content: '”';
font-size: 50px;
opacity: .15;
position: absolute;
bottom: -42px;
right: 3px;
}

.quote footer {
position: absolute;
bottom: -40px;
right: 0;
}

.quote footer img {
border-radius: 3px;
}

.quote footer a {
margin-left: 5px;
vertical-align: middle;
}

.speech-bubble {
position: relative;
padding: 10px;
background: rgba(0, 0, 0, .04);
border-radius: 5px;
}

.speech-bubble:after {
content: '';
position: absolute;
top: 100%;
right: 30px;
border: 13px solid transparent;
border-top-color: rgba(0, 0, 0, .04);
}

.learn-bar > .learn {
position: absolute;
width: 272px;
top: 8px;
left: -300px;
padding: 10px;
border-radius: 5px;
background-color: rgba(255, 255, 255, .6);
transition-property: left;
transition-duration: 500ms;
}

@media (min-width: 899px) {
.learn-bar {
width: auto;
padding-left: 300px;
}

.learn-bar > .learn {
left: 8px;
}
}
Loading

0 comments on commit 71702db

Please sign in to comment.