diff --git a/Gruntfile.js b/Gruntfile.js index 38a8c88d45fc5fa7176e3d888d6c801a59b1ba58..d1cf80291a6a0a36f676c3b408ade8fd8c85a383 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -58,6 +58,8 @@ module.exports = grunt => { build: { cmd: (pres, env) => [ + env === "dev" && "set -x ; ", + `[ -s '../src/${pres}.conf' ] && . ../src/${pres}.conf ;`, "pandoc", "--verbose", "--from=markdown+smart", @@ -66,14 +68,15 @@ module.exports = grunt => { `--output=./${pres}${env !== "prod" ? "-" + env : ""}.html`, "--standalone", "--toc", - `--toc-depth=${TOC_DEPTH}`, - `--slide-level=${SLIDE_LEVEL}`, + "--toc-depth=$TOC_DEPTH", + "--slide-level=$SLIDE_LEVEL", "--variable=lang:fr-FR", `--variable=revealjs-url:${relative(dirname(pres), "./reveal.js")}`, "--variable=theme:irstea", "--variable=history:true", "--variable=navigationMode:linear", "--variable=fragmentInURL:true", + "$PANDOC_ARGS", env === "dev" && `--variable=header-includes:"<script src='//${PUBLIC_HOST}:${LIVERELOAD_PORT}/livereload.js'></script>"` ] @@ -81,7 +84,14 @@ module.exports = grunt => { .join(" "), cwd: "dist", stdout: true, - stderr: true + stderr: true, + options: { + env: { + TOC_DEPTH: "" + TOC_DEPTH, + SLIDE_LEVEL: "" + SLIDE_LEVEL, + PANDOC_ARGS: "" + } + } } }, @@ -132,8 +142,13 @@ module.exports = grunt => { grunt.registerTask("build:pres", function(env) { const done = this.async(); readdirp - .promise("src/", { fileFilter: "*.md" }) - .then(entries => enqueueBuilds(entries.map(entry => entry.path), env)) + .promise("src/.", { fileFilter: "*.md" }) + .then(entries => + enqueueBuilds( + entries.map(entry => entry.path), + env + ) + ) .then(done, err => { grunt.log.error(err); done(false);