Skip to content

Commit 60d86ac

Browse files
committed
Add support for css modules; upgrade dependencies
1 parent eb3de03 commit 60d86ac

30 files changed

+306
-452
lines changed

.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"node": true
3131
},
3232
"globals": {
33-
'__CORDOVA__': true,
3433
'__BASE_URL__': true,
3534
expect: true
3635
},

.gitignore

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,3 @@ npm-debug.log*
55
# ignore built static files
66
dist/
77
webpack-assets.json
8-
9-
# cordova ignores
10-
cordova/www/*
11-
cordova/www/**.*
12-
!cordova/www/.gitkeep
13-
cordova/plugins/
14-
cordova/platforms/
15-
16-
# cordova build and release configurations
17-
scripts/cordova/config/*.json

README.md

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,48 @@ Direct your browser to `http://localhost:3000`.
3838

3939
## Directory Structure
4040
```
41-
├── client # Client-side code.
42-
├── common # Shared code between client and server.
43-
│   ├── assets # All fonts, images, stylsheets.
44-
│   │   ├── fonts
45-
│   │   ├── images
46-
│   │   └── stylesheets # Follows the 7-1 pattern: http://sass-guidelin.es/#the-7-1-pattern
47-
│   │   ├── base
48-
│   │   ├── components
49-
│   │   ├── layout
50-
│   │   ├── pages
51-
│   │   ├── shame
52-
│   │   ├── utils
53-
│   │   └── vendors
54-
│   ├── components # "Dumb" components directory
55-
│   ├── config # Contains the redux store configuration. Add anything else you like.
56-
│   ├── containers # "Smart" containers directory
57-
│   ├── layouts # Layout files
58-
│   ├── middleware # Custom redux middleware can be placed here.
59-
│   ├── reducers # Redux reducers
60-
| | └── index.js # Root reducer. Imports all other reducers.
61-
│   ├── routes # Routes each have an index.js which exports a react-router Route.
62-
│   │   ├── example.js # Individual routing file
63-
│   │   └── index.js # Root route
64-
│   └── selectors # Memoized selectors. See https://github.com/rackt/reselect
65-
├── server # Server-side code.
66-
└── webpack # Webpack configuration files.
41+
├── README.md
42+
├── client
43+
│   └── index.js
44+
├── common
45+
│   ├── css
46+
│   ├── fonts
47+
│   ├── images
48+
│   ├── js
49+
│   │   ├── actions
50+
│   │   ├── components # "Dumb" components
51+
│   │   ├── containers # Smart containers
52+
│   │   ├── lib # Misc. libraries like helpers, etc.
53+
│   │   ├── middleware # Middleware for redux
54+
│   │   ├── reducers # Redux reducers
55+
│   │   ├── routes # Routes each have an index.js which exports a react-router Route.
56+
│   │   ├── selectors # Selectors for getting state data
57+
│   │   └── store # Store configuration for production and dev.
58+
│   └── layouts # Layout files to be rendered by the server.
59+
├── nodemon.json
60+
├── package.json
61+
├── server
62+
│   ├── config.js
63+
│   ├── index.js
64+
│   └── server.js
65+
├── webpack
66+
│   ├── base.js
67+
│   ├── development.js
68+
│   ├── development.server.js
69+
│   ├── hmr.js
70+
│   ├── host.js
71+
│   ├── isomorphic.js
72+
│   └── production.js
73+
```
74+
75+
## CSS Modules
76+
This project uses [CSS Modules](https://github.com/css-modules/css-modules).
77+
Class names should be in `camelCase`. Place the css file as a sibling to the
78+
component with the same name, for example:
79+
```
80+
├── components
81+
│   ├── Header.js
82+
│   ├── Header.scss
6783
```
6884

6985
## Writing Tests
@@ -118,7 +134,3 @@ heroku config:set ASSET_HOST=/dist/
118134
# OR
119135
heroku config:set ASSET_HOST=https://s3.amazonaws.com/mybucket/myasssets/
120136
```
121-
122-
## Building Cordova Apps
123-
124-
Please see [Building Cordova Apps](docs/cordova.md)

client/index.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ import routes from 'routes';
1414
*/
1515
import '../common/images/favicon.png';
1616

17-
/* Stylesheets
18-
* Main.scss should @import all the other stylesheets that you need. If you want
19-
* to use LESS or another preprocessor, you can include it here and update your
20-
* webpack configure to use the appropriate loader.
21-
*/
22-
import '../common/css/main.scss';
23-
2417
// The root element of your app
2518
const rootElement = document.getElementById('app');
2619

common/css/vendors.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// vendor styles
2-
@import 'vendors/bootstrap';
2+
@import 'vendors/include-media';

common/css/vendors/_bootstrap.scss

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "~include-media/dist/include-media";

common/js/components/Header.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React, { Component } from 'react';
22
import { Link } from 'react-router';
3+
import css from './Header.scss';
34

45
export default class Header extends Component {
56
render() {
67
return (
78
<header>
8-
<ul>
9+
<ul className={css.headerLinks}>
910
<li><Link to="/">Home</Link></li>
1011
<li><Link to="/example">Example</Link></li>
1112
<li><Link to="/example/2">Example 2</Link></li>

common/js/components/Header.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
.headerLinks {
3+
color: red;
4+
}

common/layouts/server.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<body>
1111
<div id="app"><%= html %></div>
1212
<script>window.__INITIAL_STATE__ = <%= JSON.stringify(initialState) %>;</script>
13-
<script src="<%= bundleJs %>"></script>
13+
<script src="<%= vendorJs %>"></script>
14+
<script src="<%= appJs %>"></script>
1415
</body>
1516
</html>

0 commit comments

Comments
 (0)