From 7d3b28919d40c78cec0212a031e7ec5cf2c9955b Mon Sep 17 00:00:00 2001 From: Saji Date: Fri, 2 May 2025 21:44:06 -0500 Subject: [PATCH] cleanup and restructure bundle resources --- _includes/layouts/deck.njk | 39 +++++++++++++------------------------- eleventy.config.js | 8 ++++---- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/_includes/layouts/deck.njk b/_includes/layouts/deck.njk index ba1b4fd..aeeddc3 100644 --- a/_includes/layouts/deck.njk +++ b/_includes/layouts/deck.njk @@ -7,19 +7,23 @@ {{ title or metadata.title }} - - - + + {%- css %}{% include "node_modules/reveal.js/dist/reset.css" %} {% endcss %} {%- css %}{% include "node_modules/reveal.js/dist/reveal.css" %} {% endcss %} {%- css %}{% include "node_modules/reveal.js/dist/theme/black.css" %} {% endcss %} {%- css %}{% include "node_modules/reveal.js/plugin/highlight/monokai.css" %} {% endcss %} + {%- js %} + {% includeRaw "node_modules/reveal.js/dist/reveal.js" %} + {% includeRaw "node_modules/reveal.js/plugin/notes/notes.js" %} + {% includeRaw "node_modules/reveal.js/plugin/highlight/highlight.js" %} + Reveal.initialize({ + hash: true, + + // Learn about plugins: https://revealjs.com/plugins/ + plugins: [ RevealHighlight, RevealNotes ] + }); + {%- endjs %}
@@ -27,22 +31,5 @@ {{ content | safe }}
- - - - diff --git a/eleventy.config.js b/eleventy.config.js index 68bd528..bed8c22 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -14,6 +14,7 @@ import { eleventyImageTransformPlugin } from "@11ty/eleventy-img"; import pluginDrafts from "./eleventy.config.drafts.js"; +import fs from 'fs/promises' /** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */ export default async function(eleventyConfig) { @@ -21,10 +22,7 @@ export default async function(eleventyConfig) { // For example, `./public/css/` ends up in `_site/css/` eleventyConfig.addPassthroughCopy({ "./public/": "/", - "./node_modules/prismjs/themes/prism-okaidia.css": "/css/prism-okaidia.css", - "./node_modules/katex/dist/fonts/": "/bundle/fonts/", - "./node_modules/reveal.js/dist/": "/revealjs/", - "./node_modules/reveal.js/plugin/": "/revealjs-plugins/", + "./node_modules/katex/dist/fonts/": "/bundle/fonts/", // needs to be here for css reasons. }); // Watch content images for the image pipeline. @@ -139,6 +137,8 @@ export default async function(eleventyConfig) { return (new Date()).toISOString(); }) + eleventyConfig.addShortcode("includeRaw", async (file) => fs.readFile(file, "utf8")); + //eleventyConfig.addPairedShortcode("section", async (content, transition = "none") => { // return `
${mdIt.renderInline(content)}
`; //})