Skip to content

Commit 4b678cf

Browse files
committed
add base static files for test webpack
1 parent 1b4d73b commit 4b678cf

File tree

12 files changed

+112
-136
lines changed

12 files changed

+112
-136
lines changed

app.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ app.get('/', function (req, res) {
88
res.send('Hello World!');
99
});
1010

11-
var server = app.listen(3000, function () {
12-
var host = server.address().address;
11+
var server = app.listen(8888, function () {
1312
var port = server.address().port;
14-
15-
console.log('Example app listening at http://%s:%s', host, port);
13+
console.log('Example app listening at http://127.0.0.1:' + port);
1614
});

gulpfile.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ gulp.task('webpack', function() {
1919
* webpack-dev-server *
2020
**************************/
2121
gulp.task('webpack-dev-server', function() {
22-
2322
//start webpack develop server
2423
var webpackConfig = require('./webpack.dev.config');
2524
var WebpackDevServer = require('webpack-dev-server');

static/html/index.html

Lines changed: 0 additions & 122 deletions
This file was deleted.

static/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>webpack + react + sass + express</title>
6+
<link rel="stylesheet" href="http://127.0.0.1:3000/build/index.css">
7+
</head>
8+
<body>
9+
<div class="main"></div>
10+
<script src="http://127.0.0.1:3000/build/index.js"></script>
11+
</body>
12+
</html>

static/js/app.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
window.React = require('react');
2+
window.ReactDOM = require('react-dom');
3+
window.ReactRouter = require('react-router');
4+
window.Antd = require('antd');
5+
6+
import 'style/modules/pageA.scss';
7+
import Index from './modules/index';
8+
9+
var { Router ,Route, browserHistory, IndexRoute } = ReactRouter;
10+
11+
ReactDOM.render((
12+
<Router history={browserHistory}>
13+
<Route path="/" component={Index}></Route>
14+
</Router>
15+
), document.querySelectorAll('.main')[0]);

static/js/components/Header.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* 头部
3+
*/
4+
5+
export default class Header extends React.Component {
6+
constructor() {
7+
super();
8+
}
9+
10+
render() {
11+
return (
12+
<header className="g-header">
13+
<div className="setting">设置</div>
14+
<div className="quit">退出</div>
15+
</header>
16+
);
17+
}
18+
19+
componentWillMount(){
20+
21+
}
22+
23+
getDateDisplayStatus(){
24+
25+
}
26+
27+
componentWillReceiveProps(){
28+
29+
}
30+
31+
componentDidMount(){
32+
33+
}
34+
}

static/js/modules/index.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
*
3+
*/
4+
5+
import Header from '../components/Header';
6+
7+
export default class Index extends React.Component {
8+
9+
constructor() {
10+
super();
11+
}
12+
13+
render() {
14+
return (
15+
<div>
16+
<div className="g-content">
17+
<Header/>
18+
<div className="g-content-main">
19+
{this.props.children}
20+
</div>
21+
</div>
22+
</div>
23+
);
24+
}
25+
26+
componentDidMount () {
27+
28+
}
29+
30+
}
31+

static/style/components/tab.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@charset "utf-8";
2+
3+
h1 {
4+
font-size: 14px;
5+
color: #333;
6+
}

static/style/componets/tab.scss

Whitespace-only changes.

static/style/modules/pageA.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@charset "utf-8";
2+
3+
@import "../components/tab.scss";
4+
5+
body {
6+
background: #ccc;
7+
}

0 commit comments

Comments
 (0)