Skip to content

Commit 9e45e15

Browse files
committed
1.ReactRouter upgrade to 1.0.0rc1
2.using webpack to compile and bundle
1 parent 0bf251e commit 9e45e15

24 files changed

+6593
-19
lines changed

.idea/encodings.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
This is the React comment box example from [the React tutorial](http://facebook.github.io/react/docs/tutorial.html).
66

7+
## ToDo
8+
9+
>1. hot load with json data service
10+
>2. router param
11+
712
## To use
813

914
There are several simple server implementations included. They all serve static files from `public/` and handle requests to `comments.json` to fetch or add data. Start a server with one of the following:
@@ -12,7 +17,8 @@ There are several simple server implementations included. They all serve static
1217

1318
```sh
1419
npm install
15-
node server.js
20+
npm run build
21+
npm start
1622
```
1723

1824
### Python

package.json

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,43 @@
55
"main": "server.js",
66
"dependencies": {
77
"body-parser": "^1.4.3",
8-
"express": "^4.4.5"
8+
"express": "^4.4.5",
9+
"jquery": "^2.1.4",
10+
"react": "^0.13.3",
11+
"react-router": "^1.0.0-rc1"
912
},
10-
"devDependencies": {},
13+
"devDependencies": {
14+
"babel": "^5.8.23",
15+
"babel-core": "^5.8.24",
16+
"babel-loader": "^5.3.2",
17+
"css-loader": "^0.16.0",
18+
"file-loader": "^0.8.4",
19+
"style-loader": "^0.12.3",
20+
"url-loader": "^0.5.6",
21+
"webpack": "^1.11.0",
22+
"webpack-dev-server": "^1.10.1"
23+
},
1124
"scripts": {
1225
"test": "echo \"Error: no test specified\" && exit 1",
13-
"start": "node server.js"
26+
"start": "node server.js",
27+
"build": "webpack --config webpack.build.config.js",
28+
"dev": "webpack-dev-server --devtool eval --progress --colors --hot --content-base public/build",
29+
"deploy": "set NODE_ENV=production&&webpack -p --config webpack.production.config.js"
1430
},
1531
"repository": {
1632
"type": "git",
17-
"url": "https://github.com/reactjs/react-tutorial.git"
33+
"url": "https://github.com/chunwei/react-tutorial.git"
1834
},
1935
"keywords": [
2036
"react",
2137
"tutorial",
2238
"comment",
2339
"example"
2440
],
25-
"author": "petehunt",
26-
"bugs": {
27-
"url": "https://github.com/reactjs/react-tutorial/issues"
28-
},
29-
"homepage": "https://github.com/reactjs/react-tutorial",
30-
"engines" : {
31-
"node" : "0.12.x"
41+
"author": "Lu Chunwei <[email protected]>",
42+
"license": "ISC",
43+
"homepage": "https://github.com/chunwei/react-tutorial",
44+
"engines": {
45+
"node": "0.12.x"
3246
}
3347
}

public/index-.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1">
6+
<meta name="viewport"
7+
content="width=device-width, initial-scale=1,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
8+
<title>Hello React</title>
9+
<!-- Not present in the tutorial. Just for basic styling. -->
10+
<link rel="stylesheet" href="css/base.css"/>
11+
<link rel="stylesheet" href="css/comment.css"/>
12+
<script src="lib/react.js"></script>
13+
<script src="lib/JSXTransformer.js"></script>
14+
<script src="lib/ReactRouter.min.js"></script>
15+
<script src="lib/jquery.min.js"></script>
16+
<script src="lib/marked.min.js"></script>
17+
</head>
18+
<body>
19+
<div id="content"></div>
20+
<script type="text/jsx;harmony=true" src="scripts/rr-example.js"></script>
21+
</body>
22+
</html>

public/index.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@
77
<title>Hello React</title>
88
<!-- Not present in the tutorial. Just for basic styling. -->
99
<link rel="stylesheet" href="css/base.css" />
10-
<link rel="stylesheet" href="css/comment.css" />
11-
<script src="lib/react.js"></script>
12-
<script src="lib/JSXTransformer.js"></script>
13-
<script src="lib/ReactRouter.min.js"></script>
14-
<script src="lib/jquery.min.js"></script>
15-
<script src="lib/marked.min.js"></script>
10+
11+
1612
</head>
1713
<body>
1814
<div id="content"></div>
19-
<script type="text/jsx;harmony=true" src="scripts/example.js"></script>
15+
<script src="build/app.js"></script>
2016
</body>
2117
</html>

0 commit comments

Comments
 (0)