renamed grunt 'base' option to 'root' (#1660)

* Allow slides to be served away from revealjs server location

The previous 'base' option conflicts with Grunt's 'base' option.
Changing it to 'root' avoids this. Further, updating to a newer Grunt
allows multiple parameters to be used. therefore `grunt serve --root="."
--root="pathtomyslides"` allows you to keep your slide content separate
from JS/CSS and such

* Live reload for relocated base

* Updated packages to match origin/dev

* Updated packages to match origin/dev

* Ensure root is an array
This commit is contained in:
CH 2016-10-05 11:45:37 +02:00 committed by Hakim El Hattab
parent 693a370f06
commit 2cf00254a1
2 changed files with 10 additions and 6 deletions

View File

@ -1,7 +1,9 @@
/* global module:false */ /* global module:false */
module.exports = function(grunt) { module.exports = function(grunt) {
var port = grunt.option('port') || 8000; var port = grunt.option('port') || 8000;
var base = grunt.option('base') || '.'; var root = grunt.option('root') || '.';
if (!Array.isArray(root)) root = [root];
// Project configuration // Project configuration
grunt.initConfig({ grunt.initConfig({
@ -69,6 +71,7 @@ module.exports = function(grunt) {
curly: false, curly: false,
eqeqeq: true, eqeqeq: true,
immed: true, immed: true,
esnext: true,
latedef: true, latedef: true,
newcap: true, newcap: true,
noarg: true, noarg: true,
@ -93,11 +96,12 @@ module.exports = function(grunt) {
server: { server: {
options: { options: {
port: port, port: port,
base: base, base: root,
livereload: true, livereload: true,
open: true open: true
} }
} },
}, },
zip: { zip: {
@ -126,10 +130,10 @@ module.exports = function(grunt) {
tasks: 'css-core' tasks: 'css-core'
}, },
html: { html: {
files: [ '*.html'] files: root.map(path => path + '/*.html')
}, },
markdown: { markdown: {
files: [ '*.md' ] files: root.map(path => path + '/*.md')
}, },
options: { options: {
livereload: true livereload: true

View File

@ -28,7 +28,7 @@
"socket.io": "^1.4.8" "socket.io": "^1.4.8"
}, },
"devDependencies": { "devDependencies": {
"grunt": "~0.4.5", "grunt": "~1.0.1",
"grunt-autoprefixer": "~3.0.3", "grunt-autoprefixer": "~3.0.3",
"grunt-contrib-connect": "~0.11.2", "grunt-contrib-connect": "~0.11.2",
"grunt-contrib-cssmin": "~0.14.0", "grunt-contrib-cssmin": "~0.14.0",