reload = function () {
return es.map(function(file, callback) {
apps.forEach((function(_this) {
return function(app) {
if (app.livereload && typeof app.lr === "object") {
return app.lr.changed({
body: {
files: file.path
}
});
}
};
})(this));
return callback(null, file);
});
}...
root: 'app',
livereload: true
});
});
gulp.task('html', function () {
gulp.src('./app/*.html')
.pipe(connect.reload());
});
gulp.task('watch', function () {
gulp.watch(['./app/*.html'], ['html']);
});
gulp.task('default', ['connect', 'watch']);
...server = function (options) {
var app;
if (options == null) {
options = {};
}
app = new ConnectApp(options);
apps.push(app);
return app;
}...
## Usage
```js
var gulp = require('gulp'),
connect = require('gulp-connect');
gulp.task('connect', function() {
connect.server();
});
gulp.task('default', ['connect']);
```
#### LiveReload
```js
...serverClose = function () {
apps.forEach(function(app) {
return app.server.close();
});
return apps = [];
}...
```js
gulp.task('jenkins-tests', function() {
connect.server({
port: 8888
});
// run some headless tests with phantomjs
// when process exits:
connect.serverClose();
});
```
#### Multiple server
```js
...reload = function () {
return es.map(function(file, callback) {
apps.forEach((function(_this) {
return function(app) {
if (app.livereload && typeof app.lr === "object") {
return app.lr.changed({
body: {
files: file.path
}
});
}
};
})(this));
return callback(null, file);
});
}...
root: 'app',
livereload: true
});
});
gulp.task('html', function () {
gulp.src('./app/*.html')
.pipe(connect.reload());
});
gulp.task('watch', function () {
gulp.watch(['./app/*.html'], ['html']);
});
gulp.task('default', ['connect', 'watch']);
...server = function (options) {
var app;
if (options == null) {
options = {};
}
app = new ConnectApp(options);
apps.push(app);
return app;
}...
## Usage
```js
var gulp = require('gulp'),
connect = require('gulp-connect');
gulp.task('connect', function() {
connect.server();
});
gulp.task('default', ['connect']);
```
#### LiveReload
```js
...serverClose = function () {
apps.forEach(function(app) {
return app.server.close();
});
return apps = [];
}...
```js
gulp.task('jenkins-tests', function() {
connect.server({
port: 8888
});
// run some headless tests with phantomjs
// when process exits:
connect.serverClose();
});
```
#### Multiple server
```js
...