Commit 6b1f306c authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Intègre plus proprement le rebuild de reveal.js.

parent f0753482
import * as revealJS from "@inrae/reveal.js/gulpfile.esm";
import { dest, lastRun, parallel, series, src, watch } from "gulp";
import del from "del";
import drawio from "./lib/drawio";
import index from "./lib/index";
import pandoc from "./lib/pandoc";
import path from "path";
import revealjs from "@inrae/reveal.js/gulpfile.esm";
import server from "gulp-server-livereload";
import wkhtmltopdf from "./lib/wkhtmltopdf";
......@@ -38,17 +37,29 @@ export const graphs = () =>
export const pdf = () => src(PDF_GLOB).pipe(wkhtmltopdf()).pipe(dest(DEST_DIR));
export const library = !REVEALJS_URL.startsWith("http")
? series(revealjs, () =>
src(__dirname + "/node_modules/@inrae/reveal.js/public/**").pipe(
dest(path.join(DEST_DIR, REVEALJS_URL))
)
)
: () => false;
const noop = () => false;
export const [build_revealjs, watch_revealjs] = (function (url) {
if (url.startsWith("http")) {
return [noop, noop];
}
const SRC = `${__dirname}/node_modules/@inrae/reveal.js/public/**`;
const DST = DEST_DIR + "/" + url;
const copy_revealjs = () =>
src(SRC, { since: lastRun(copy_revealjs) }).pipe(dest(DST));
const _watch_revealjs = () => watch(SRC, copy_revealjs);
return [
series(revealJS.build, copy_revealjs),
parallel(revealJS.dev, _watch_revealjs),
];
})(REVEALJS_URL);
export const build = series(
clean,
parallel(library, assets, prez, graphs),
parallel(build_revealjs, assets, prez, graphs),
pdf
);
......@@ -69,7 +80,14 @@ const watch_pdf = () => watch(`${DEST_DIR}/**/*.{html,svg,jpg,gif,png}`, pdf);
export const dev = series(
build,
parallel(serve, watch_prez, watch_assets, watch_graphs, watch_pdf)
parallel(
serve,
watch_prez,
watch_assets,
watch_graphs,
watch_pdf,
watch_revealjs
)
);
export default build;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment