Skip to content

Commit e95d75f

Browse files
committed
1.Combining webpack-dev-server with an existing backend server
2.autoprefixer-loader : automatically add css prefix like -moz -webkit
1 parent 9e45e15 commit e95d75f

File tree

8 files changed

+23
-6
lines changed

8 files changed

+23
-6
lines changed

.idea/encodings.xml

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

.idea/libraries/react_comment_node_modules.xml

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"react-router": "^1.0.0-rc1"
1212
},
1313
"devDependencies": {
14+
"autoprefixer-loader": "^3.1.0",
1415
"babel": "^5.8.23",
1516
"babel-core": "^5.8.24",
1617
"babel-loader": "^5.3.2",
@@ -25,7 +26,7 @@
2526
"test": "echo \"Error: no test specified\" && exit 1",
2627
"start": "node server.js",
2728
"build": "webpack --config webpack.build.config.js",
28-
"dev": "webpack-dev-server --devtool eval --progress --colors --hot --content-base public/build",
29+
"dev-server": "webpack-dev-server --devtool eval --progress --colors --hot --content-base public/build",
2930
"deploy": "set NODE_ENV=production&&webpack -p --config webpack.production.config.js"
3031
},
3132
"repository": {

public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
</head>
1313
<body>
1414
<div id="content"></div>
15-
<script src="build/app.js"></script>
15+
<script src="http://localhost:8080/webpack-dev-server.js"></script>
16+
<script src="http://localhost:8080/app.js"></script>
1617
</body>
1718
</html>

src/components/comment/CommentBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var CommentBox = React.createClass({
6464

6565
return (
6666
<div className="commentBox">
67-
<h1>Comments</h1>
67+
<h1>Comments - 评论</h1>
6868
<CommentList data={this.state.data}/>
6969
<CommentBar/>
7070
{/*

webpack.build.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525
loader: 'babel-loader'// The module to load. "babel" is short for "babel-loader"
2626
}, {
2727
test: /\.css$/,
28-
loader: 'style!css' //shortcut, Run both loaders style-loader and css-loader
28+
loader: 'style!css!autoprefixer?{browsers:["last 2 version", "> 1%"]}' //shortcut, Run both loaders style-loader and css-loader
2929
}, {
3030
test: /\.(png|jpg)$/,
3131
loader: 'url-loader?limit=16384' //images that er 25KB or smaller in size will be converted to a BASE64 string and included in the CSS file where it is defined

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525
loader: 'babel-loader'// The module to load. "babel" is short for "babel-loader"
2626
}, {
2727
test: /\.css$/,
28-
loader: 'style!css' //shortcut, Run both loaders style-loader and css-loader
28+
loader: 'style!css!autoprefixer?{browsers:["last 2 version", "> 1%"]}' //shortcut, Run both loaders style-loader and css-loader
2929
}, {
3030
test: /\.(png|jpg)$/,
3131
loader: 'url-loader?limit=16384' //images that er 25KB or smaller in size will be converted to a BASE64 string and included in the CSS file where it is defined

webpack.production.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
loader: 'babel-loader'// The module to load. "babel" is short for "babel-loader"
1919
}, {
2020
test: /\.css$/,
21-
loader: 'style!css' //shortcut, Run both loaders style-loader and css-loader
21+
loader: 'style!css!autoprefixer?{browsers:["last 2 version", "> 1%"]}' //shortcut, Run both loaders style-loader and css-loader
2222
}, {
2323
test: /\.(png|jpg)$/,
2424
loader: 'url-loader?limit=16384' //images that er 25KB or smaller in size will be converted to a BASE64 string and included in the CSS file where it is defined

0 commit comments

Comments
 (0)