Skip to content

Commit ee4b385

Browse files
author
bin.cao
committed
add scss style files; modify webpack config; modify node app.js;
1 parent 419c773 commit ee4b385

File tree

9 files changed

+36
-5076
lines changed

9 files changed

+36
-5076
lines changed

app.js

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
1+
var path = require('path');
12
var express = require('express');
2-
var cookieParser = require('cookie-parser');
3-
var bodyParser = require('body-parser');
4-
var favicon = require('serve-favicon');
5-
var nodeAnnotation = require('node-annotation');
3+
var app = express();
64

7-
var fs = require('fs');
8-
var Path = require('path');
5+
app.use('/static', express.static(path.join(__dirname, 'static')));
96

10-
nodeAnnotation.setLogger(true);
11-
// nodeAnnotation.configurePath(Path.join(cwd, 'src', 'webApp', 'resource'));
12-
nodeAnnotation.start([
13-
Path.join(__dirname, 'src'),
14-
Path.join(__dirname, 'node_modules', 'node-annotation-extend', 'src')
15-
], function() {
16-
var app = express();
7+
app.get('/', function (req, res) {
8+
res.send('Hello World!');
9+
});
10+
11+
var server = app.listen(3000, function () {
12+
var host = server.address().address;
13+
var port = server.address().port;
1714

18-
app.set('views', Path.join(__dirname, '/src/views'));
19-
app.set('view engine', 'ejs');
20-
app.use(bodyParser.json());
21-
app.use(bodyParser.urlencoded());
22-
app.use(cookieParser());
23-
app.use(express.static(Path.join(__dirname, 'public')));
24-
app.use('/prd', express.static(Path.join(__dirname, 'prd')));
25-
nodeAnnotation.app(app);
26-
//初始化数据库
27-
var sequelizeDB = require("./src/js/dao/mysql/common/sequelizeDB.js");
28-
var server = app.listen(3939, function() {
29-
console.log('Express server listening on port %d in %s mode', server.address().port, app.settings.env);
30-
});
15+
console.log('Example app listening at http://%s:%s', host, port);
3116
});

gulpfile.js

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,20 @@ var clean = require('gulp-clean');
55
/**************************
66
* webpack *
77
**************************/
8-
gulp.task('webpack', ['clean'], function() {
8+
gulp.task('webpack', function() {
99
var webpackConfig = require('./webpack.config');
1010
var gulpWebpack = require('gulp-webpack');
1111

1212
return gulp
13-
.src('prd')
13+
.src('build')
1414
.pipe(clean())
1515
.pipe(gulpWebpack(webpackConfig))
16-
.pipe(gulp.dest('./prd'));
17-
});
18-
/**************************
19-
* clean *
20-
**************************/
21-
gulp.task('clean', function(){
22-
return gulp
23-
.src(Path.join('src', 'node_modules'))
24-
.pipe(clean());
25-
});
26-
/**************************
27-
* libDev *
28-
**************************/
29-
gulp.task('libDev', ['clean'], function() {
30-
//load concat the library
31-
//加快开发模式下模块编译的速度,提前把第三方库生成好
32-
return gulp
33-
.src(Path.join('src', 'development', '**', '*.*'))
34-
.pipe(gulp.dest(Path.join('src', 'node_modules')));
16+
.pipe(gulp.dest('./build'));
3517
});
3618
/**************************
3719
* webpack-dev-server *
3820
**************************/
39-
gulp.task('webpack-dev-server', ['libDev'], function() {
21+
gulp.task('webpack-dev-server', function() {
4022

4123
//start webpack develop server
4224
var webpackConfig = require('./webpack.dev.config');
@@ -78,4 +60,4 @@ gulp.task('default', function() {
7860
});
7961
gulp.task('dev', ['copyProfile', 'webpack-dev-server']);
8062
gulp.task('beta', ['webpack']);
81-
gulp.task('prod', ['webpack']);
63+
gulp.task('prod', ['webpack']);

0 commit comments

Comments
 (0)