Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Commit

Permalink
use express instead of gulp-webserver. Fixes #780 and #773.
Browse files Browse the repository at this point in the history
  • Loading branch information
toolness committed Apr 22, 2015
1 parent 7a53a5f commit 3d5bf10
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
14 changes: 5 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var path = require('path');
var webserver = require('gulp-webserver');
var _ = require('underscore');
var gulp = require('gulp');
var gulpif = require('gulp-if');
Expand Down Expand Up @@ -31,6 +30,7 @@ require('node-jsx').install();
var IndexFileStream = require('./lib/gulp-index-file-stream');
var webpackConfig = require('./webpack.config');
var travis = require('./lib/travis');
var server = require('./test/browser/server');

var BUILD_TASKS = [
'beautify',
Expand Down Expand Up @@ -253,14 +253,10 @@ gulp.task('watch', _.without(BUILD_TASKS, 'webpack'), function() {
process.exit(0);
});

gulp.src('dist')
.pipe(webserver({
livereload: {
enable: true
},
host: '0.0.0.0',
port: 8008
}));
server.create().listen(8008, function() {
gutil.log('Development server listening at ' +
gutil.colors.green.bold('http://localhost:8008') + '.');
});
});

gulp.task('travis-after-success', function(cb) {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"gulp-sourcemaps": "^1.5.0",
"gulp-util": "^3.0.4",
"gulp-webpack": "^1.2.0",
"gulp-webserver": "^0.9.0",
"imports-loader": "^0.6.3",
"json-loader": "^0.5.1",
"jsx-loader": "^0.12.2",
Expand Down
8 changes: 1 addition & 7 deletions test/browser/run-in-phantom.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
var http = require('http');
var path = require('path');
var chalk = require('chalk');
var express = require('express');

var ROOT_DIR = path.normalize(path.join(__dirname, '..', '..'));

var app = express();

var server = http.createServer(app);

app.use(express.static(path.join(ROOT_DIR, 'dist')));
var server = require('./server').create();

server.listen(0, function() {
var baseURL = 'http://localhost:' + server.address().port;
Expand Down
14 changes: 14 additions & 0 deletions test/browser/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var http = require('http');
var path = require('path');
var express = require('express');

var ROOT_DIR = path.normalize(path.join(__dirname, '..', '..', 'dist'));

exports.create = function create() {
var app = express();
var server = http.createServer(app);

app.use(express.static(ROOT_DIR));

return server;
};

0 comments on commit 3d5bf10

Please sign in to comment.