Skip to content

Commit

Permalink
Merge pull request #9 from pichfl/theme-config
Browse files Browse the repository at this point in the history
allow themes to be able to provide config for initialize
  • Loading branch information
mansona authored Jul 17, 2024
2 parents 0148dc1 + c01019e commit 297db56
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,24 @@ document.querySelector('.slides').innerHTML = sections.join('');

const deck = new Reveal();

deck.initialize({
const defaultConfig = {
hash: true,
width: 1280,
height: 960,
margin: 0.1,
highlight: {},
plugins: [Markdown, Highlight, Notes],
});
};

let themeConfig = {};

try {
const findingConfig = import.meta.glob('@theme/config.json', {eager: true});
const [filename] = Object.keys(findingConfig);

if (filename) {
themeConfig = findingConfig[filename]
}
} catch {}

deck.initialize({...defaultConfig, ...themeConfig});

0 comments on commit 297db56

Please sign in to comment.