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

Copie tout le contenu de src, en plus de convertir les MD.

parent 20b9302e
const { readdirSync } = require("fs");
const readdirp = require("readdirp");
const { extname } = require("path");
module.exports = grunt => {
const PUBLIC_HOST = process.env.PUBLIC_HOST || "localhost";
......@@ -28,7 +29,7 @@ module.exports = grunt => {
files: ["Gruntfile.js"]
},
presentations: {
files: "src/**/*.md",
files: "src/**/*",
tasks: [],
options: {
debounceDelay: 1000,
......@@ -78,6 +79,12 @@ module.exports = grunt => {
cwd: "node_modules/reveal.js/.",
src: revealJsSources,
dest: "dist/reveal.js/"
},
sources: {
expand: true,
cwd: "src/",
src: ["**/*", "!**/.*", "!**/*.md"],
dest: "dist/"
}
},
......@@ -94,9 +101,14 @@ module.exports = grunt => {
grunt.registerTask("serve", ["http-server", "build:dev", "watcher"]);
grunt.registerTask("build:revealjs", ["copy:revealjs"]);
grunt.registerTask("build:sources", ["copy:sources"]);
grunt.registerTask("build", env =>
grunt.task.run(["build:revealjs", `build:pres:${env || "prod"}`])
grunt.task.run([
"build:revealjs",
"build:sources",
`build:pres:${env || "prod"}`
])
);
const enqueueBuilds = (paths, env) =>
......@@ -109,9 +121,16 @@ module.exports = grunt => {
)
);
grunt.registerTask("build:pres", env =>
enqueueBuilds(readdirSync("src/"), env)
);
grunt.registerTask("build:pres", function(env) {
const done = this.async();
readdirp
.promise("src/", { fileFilter: "*.md" })
.then(entries => enqueueBuilds(entries.map(entry => entry.path), env))
.then(done, err => {
grunt.log.error(err);
done(false);
});
});
grunt.event.removeAllListeners("chokidar");
grunt.event.on("chokidar", function(_, filepath, target) {
......
......@@ -26,6 +26,7 @@
"grunt-exec": "^3.0.0",
"grunt-http-server": "^2.1.0",
"grunt-watcher": "^1.0.0",
"readdirp": "^3.2.0",
"reveal.js": "git+https://gitlab.irstea.fr/guillaume.perreal/reveal.js.git#irstea"
},
"devDependencies": {
......
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