Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
"use strict";
var gulp = require('gulp');
gulp.task('connect', function () {
var connect = require('connect');
var serveIndex = require('serve-index');
var serveStatic = require('serve-static');
var app = connect()
.use(require('connect-livereload')({ port: 35729 }))
.use(serveStatic('.'));
require('http').createServer(app)
.listen(8510)
.on('listening', function() {
console.log('Started connect web server on http://localhost:8510.');
});
});
gulp.task('server', ['connect'], function () {
var livereload = require('gulp-livereload');
livereload.listen();
require('opn')('http://localhost:8510');
gulp.watch(
'**/*'
).on('change', livereload.changed);
});
gulp.task('default',['server']);
{
"name": "front-web",
"version": "0.1.0",
"devDependencies": {
"connect": "^3.4.0",
"connect-livereload": "^0.5.3",
"gulp": "^3.9.0",
"opn": "^3.0.2",
"serve-index": "^1.7.0",
"serve-static": "^1.10.0",
"gulp-livereload": "^3.8.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.