From ae4d9cc3e08fc85d5b028268578ba93ec6a063d3 Mon Sep 17 00:00:00 2001 From: tpxb4235 Date: Wed, 2 Dec 2015 11:34:08 +0100 Subject: [PATCH] feat(build): livereload added grunt serve ability livereload on sccs changes --- Gruntfile.js | 42 +++++++++++++++++++++++++++++++++++++----- package.json | 3 ++- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index e0128d3e29..61805ae87b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -15,6 +15,9 @@ module.exports = function (grunt) { return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); }; + /* boosted mod */ + var serveStatic = require('serve-static'); + /* end mod */ var fs = require('fs'); var path = require('path'); var glob = require('glob'); @@ -336,14 +339,28 @@ module.exports = function (grunt) { } }, + /* boosted mod */ connect: { - server: { + // server: { + // options: { + // port: 3000, + // base: '.' + // } + // } + // }, + livereload: { options: { - port: 3000, - base: '.' + open: true, + port: 9000, + middleware: function (connect) { + return [ + serveStatic('_gh_pages') + ]; + } } } - }, + }, + /* end mod */ jekyll: { options: { @@ -380,7 +397,12 @@ module.exports = function (grunt) { }, sass: { files: 'scss/**/*.scss', - tasks: ['dist-css', 'docs'] + tasks: ['dist-css', 'docs'], + /* boosted mod */ + options: { + livereload: '<%= connect.options.livereload %>' + } + /* end mod */ }, docs: { files: 'docs/assets/scss/**/*.scss', @@ -541,4 +563,14 @@ module.exports = function (grunt) { done(); }); }); + + /* boosted mod */ + grunt.registerTask('serve', 'Compile then start a connect web server', function (target) { + grunt.task.run([ + 'dist', + 'connect:livereload', + 'watch' + ]); + }); + /* end mod */ }; diff --git a/package.json b/package.json index 8ffcfd56b0..028c21086a 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,8 @@ "markdown-it": "^5.0.0", "mq4-hover-shim": "^0.3.0", "npm-shrinkwrap": "^200.1.0", - "time-grunt": "^1.2.1" + "time-grunt": "^1.2.1", + "serve-static": "^1.10.0" }, "engines": { "node": ">=0.10.1"