From 70ce2feefbb37368b9f01b5ccd4b7f2864368d03 Mon Sep 17 00:00:00 2001 From: Tom Raithel Date: Fri, 10 Feb 2017 20:00:37 +0100 Subject: [PATCH] Add liveServer --- package.json | 1 + tasks/watch.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0de6e17..87bd501 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "babel-preset-stage-0": "6.22.0", "front-matter": "2.1.2", "fs-extra": "2.0.0", + "live-server": "1.2.0", "marked": "0.3.6", "postcss-cli": "2.6.0", "postcss-easy-import": "2.0.0", diff --git a/tasks/watch.js b/tasks/watch.js index be1ddb3..bddc9c0 100644 --- a/tasks/watch.js +++ b/tasks/watch.js @@ -1,5 +1,6 @@ import { watch } from 'fs'; import { exec } from 'child_process'; +import liveServer from 'live-server'; import { stylesPath, @@ -8,6 +9,7 @@ import { radarPath, staticPath, templatesPath, + distPath, } from './file'; const watchBuild = (name) => (eventType, fileName) => { @@ -32,4 +34,8 @@ watch(radarPath(), options, watchBuild('pages')); watch(staticPath(), options, watchBuild('pages')); watch(templatesPath(), options, watchBuild('pages')); -console.log('Watching for changes, press CTRL+C to quit'); +var params = { + root: distPath(), + logLevel: 2, // 0 = errors only, 1 = some, 2 = lots +}; +liveServer.start(params);