From b100eb0d3f63b392d2cad341cb6bd542a28672b3 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Mon, 30 May 2016 22:55:54 +0200 Subject: [PATCH] Added GulpJS development server task (gulp serve) --- README.md | 6 +++++- gulpfile.coffee | 7 +++++++ package.json | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a49304..c8dd873 100644 --- a/README.md +++ b/README.md @@ -36,4 +36,8 @@ and the rebuild the webapp with: gulp ``` -The webapp is accessible in the `dist/` directory +The webapp is accessible in the `dist/` directory. A development server can be started with + +``` +gulp serve +``` diff --git a/gulpfile.coffee b/gulpfile.coffee index f7d6c74..5998eb0 100644 --- a/gulpfile.coffee +++ b/gulpfile.coffee @@ -11,6 +11,7 @@ merge = require 'merge-stream' path = require 'path' fs = require 'fs' glob = require 'glob' +connect = require 'gulp-connect' gulp.task 'coffee', () -> @@ -98,6 +99,12 @@ gulp.task 'precache', (callback) -> filePath = path.join dir, 'precache.json' fs.writeFile filePath, JSON.stringify(files), callback +gulp.task 'serve', (callback) -> + connect.server({ + port: 8080 + root: 'dist' + }) + gulp.task 'clean', del.bind null, ['dist'] gulp.task 'default', ['clean'], (cb) -> diff --git a/package.json b/package.json index e2d854b..a89517f 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "gulp-autoprefixer": "^2.1.0", "gulp-cache": "^0.2.10", "gulp-coffee": "^2.3.1", + "gulp-connect": "^4.0.0", "gulp-if": "^1.2.5", "gulp-imagemin": "^2.3.0", "gulp-load-plugins": "^0.10.0",