From 4660831b9ce58895e76ae53c3087bc1e5c5783f0 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 23 May 2020 02:11:35 +0100 Subject: [PATCH] Re-add highlightjs Fixes #67 --- web/themes/custom/opdavies/opdavies.libraries.yml | 2 ++ web/themes/custom/opdavies/src/app.js | 7 +++++++ web/themes/custom/opdavies/webpack.mix.js | 2 ++ 3 files changed, 11 insertions(+) create mode 100644 web/themes/custom/opdavies/src/app.js diff --git a/web/themes/custom/opdavies/opdavies.libraries.yml b/web/themes/custom/opdavies/opdavies.libraries.yml index 9e821fc..b836133 100644 --- a/web/themes/custom/opdavies/opdavies.libraries.yml +++ b/web/themes/custom/opdavies/opdavies.libraries.yml @@ -4,6 +4,8 @@ global-styling: dist/tailwind.css: {} global-scripts: js: + dist/js/app.js: {} + 'https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js': type: external minified: true diff --git a/web/themes/custom/opdavies/src/app.js b/web/themes/custom/opdavies/src/app.js new file mode 100644 index 0000000..adea53d --- /dev/null +++ b/web/themes/custom/opdavies/src/app.js @@ -0,0 +1,7 @@ +import hljs from 'highlightjs' + +document.addEventListener('DOMContentLoaded', event => { + document.querySelectorAll('pre code').forEach(block => { + hljs.highlightBlock(block) + }) +}) diff --git a/web/themes/custom/opdavies/webpack.mix.js b/web/themes/custom/opdavies/webpack.mix.js index 4098a79..7fd1f55 100644 --- a/web/themes/custom/opdavies/webpack.mix.js +++ b/web/themes/custom/opdavies/webpack.mix.js @@ -6,3 +6,5 @@ mix.postCss('src/tailwind.pcss', 'dist', [ require('postcss-nested'), require('autoprefixer') ]) + +mix.js('src/app.js', 'dist/js')