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

Utilise gulp pour construire et/ou servir les présentations.

parent 7b85de15
......@@ -2,7 +2,7 @@ root=true
[*]
end_of_line = lf
indent_size = 4
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
charset = utf-8
......
const { src, dest, parallel, watch } = require("gulp");
const server = require("gulp-server-livereload");
const pandoc = require("gulp-pandoc");
const SRC_DIR = process.env.SRC || "src";
const DEST_DIR = process.env.OUTPUT || "public/";
const REVEALJS_URL =
process.env.REVEALJS_URL ||
"https://pole-is.gitlab.irstea.page/tools/reveal.js";
const images = () => src(`${SRC_DIR}/**/*.{png,gif,jpg}`).pipe(dest(DEST_DIR));
const prez = () =>
src(`${SRC_DIR}/**/index.md`)
.pipe(
pandoc({
from:
"markdown+backtick_code_blocks+pandoc_title_block+yaml_metadata_block",
to: "revealjs",
ext: ".html",
args: [
"--standalone",
"--slide-level=2",
"--toc",
"--toc-depth=2",
`--variable=revealjs-url:${REVEALJS_URL}`,
"--variable=width:1024",
"--variable=height:768",
"--variable=history:true",
"--variable=navigationMode:linear",
"--variable=fragmentInURL:true",
"--variable=theme:inrae",
"--variable=slideNumber:true",
],
})
)
.pipe(dest(DEST_DIR));
exports.default = exports.build = parallel(images, prez);
const serve = () => {
src(DEST_DIR).pipe(
server({
host: process.env.SERVER_HOST || "localhost",
port: 0 + process.env.SERVER_PORT || 3000,
livereload: true,
})
);
};
const watch_prez = () =>
watch(`${SRC_DIR}/**/index.md`, { ignoreInitial: false }, prez);
const watch_images = () =>
watch(`${SRC_DIR}/**/*.{png,gif,jpg}`, { ignoreInitial: false }, images);
exports.dev = parallel(serve, watch_prez, watch_images);
This diff is collapsed.
{
"name": "prezbuilder",
"version": "1.0.0",
"description": "Build INRAE-themed reveal.js presentatiokns.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"reveal.js",
"inrae"
],
"author": "Guillaume Perréal <guillaume.perreal@inrae.fr>",
"license": "MIT",
"dependencies": {
"gulp": "^4.0.2",
"gulp-pandoc": "^0.2.2",
"gulp-server-livereload": "^1.9.2"
},
"devDependencies": {
"prettier": "^2.0.5"
}
}
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