diff --git a/.gitignore b/.gitignore index 6b148de..3e0d28d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules .d.ts coverage demo/index.html -**/custom-elements.json \ No newline at end of file +demo/highlight-hybrid.css +**/custom-elements.json diff --git a/demo/template.html b/demo/template.html index d7033ca..573a3dc 100644 --- a/demo/template.html +++ b/demo/template.html @@ -9,7 +9,7 @@ content="A Web Component abstraction to declaratively render elements that depend on asynchronous processes" /> Suspense Element - + diff --git a/marked/buildHtmlFromMd.js b/marked/buildHtmlFromMd.js index a8e5a58..a29d910 100644 --- a/marked/buildHtmlFromMd.js +++ b/marked/buildHtmlFromMd.js @@ -29,5 +29,12 @@ export const buildHtmlFromMd = async () => { path.resolve(rootFolder, `index.html`), template.replace('{{ content }}', htmlString), ); + + // Pick a highlight.js theme and put it in the rootfolder so this folder can + // be deployed and work anywhere (e.g. netlify, heroku, whatever). + await fs.copyFile( + path.resolve('node_modules', 'highlight.js', 'styles', 'hybrid.css'), + path.resolve(rootFolder, 'highlight-hybrid.css'), + ); } }; diff --git a/marked/watch-marked.js b/marked/watch-marked.js index 61560e5..d401c30 100644 --- a/marked/watch-marked.js +++ b/marked/watch-marked.js @@ -4,6 +4,8 @@ import { buildHtmlFromMd } from './buildHtmlFromMd.js'; const watcher = chokidar.watch(path.resolve()); +buildHtmlFromMd(); + watcher.on('change', (filePath) => { if (filePath.endsWith('.md') || filePath.endsWith('template.html') || filePath.endsWith('.css')) { buildHtmlFromMd();