From 2991c30d4d5edcf93378a3fba7a66ada01fe29fb Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Wed, 29 May 2019 02:34:45 -0600 Subject: [PATCH] make highlight.js script self-contained --- src/js/vendor/highlight.js | 69 +++++++++++++++++++++-------------------- src/partials/footer-scripts.hbs | 3 +- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/js/vendor/highlight.js b/src/js/vendor/highlight.js index 0c751ae..b7624c4 100644 --- a/src/js/vendor/highlight.js +++ b/src/js/vendor/highlight.js @@ -1,33 +1,36 @@ -var hljs = (window.hljs = require('highlight.js/lib/highlight')) -hljs.registerLanguage('apache', require('highlight.js/lib/languages/apache')) -hljs.registerLanguage('asciidoc', require('highlight.js/lib/languages/asciidoc')) -hljs.registerLanguage('bash', require('highlight.js/lib/languages/bash')) -hljs.registerLanguage('clojure', require('highlight.js/lib/languages/clojure')) -hljs.registerLanguage('cpp', require('highlight.js/lib/languages/cpp')) -hljs.registerLanguage('cs', require('highlight.js/lib/languages/cs')) -hljs.registerLanguage('css', require('highlight.js/lib/languages/css')) -hljs.registerLanguage('diff', require('highlight.js/lib/languages/diff')) -hljs.registerLanguage('dockerfile', require('highlight.js/lib/languages/dockerfile')) -hljs.registerLanguage('groovy', require('highlight.js/lib/languages/groovy')) -hljs.registerLanguage('haskell', require('highlight.js/lib/languages/haskell')) -hljs.registerLanguage('http', require('highlight.js/lib/languages/http')) -hljs.registerLanguage('ini', require('highlight.js/lib/languages/ini')) -hljs.registerLanguage('java', require('highlight.js/lib/languages/java')) -hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript')) -hljs.registerLanguage('json', require('highlight.js/lib/languages/json')) -hljs.registerLanguage('kotlin', require('highlight.js/lib/languages/kotlin')) -hljs.registerLanguage('makefile', require('highlight.js/lib/languages/makefile')) -hljs.registerLanguage('markdown', require('highlight.js/lib/languages/markdown')) -hljs.registerLanguage('nginx', require('highlight.js/lib/languages/nginx')) -hljs.registerLanguage('nix', require('highlight.js/lib/languages/nix')) -hljs.registerLanguage('objectivec', require('highlight.js/lib/languages/objectivec')) -hljs.registerLanguage('perl', require('highlight.js/lib/languages/perl')) -hljs.registerLanguage('php', require('highlight.js/lib/languages/php')) -hljs.registerLanguage('python', require('highlight.js/lib/languages/python')) -hljs.registerLanguage('ruby', require('highlight.js/lib/languages/ruby')) -hljs.registerLanguage('scala', require('highlight.js/lib/languages/scala')) -hljs.registerLanguage('shell', require('highlight.js/lib/languages/shell')) -hljs.registerLanguage('sql', require('highlight.js/lib/languages/sql')) -hljs.registerLanguage('swift', require('highlight.js/lib/languages/swift')) -hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml')) -hljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml')) +;(function () { + var hljs = require('highlight.js/lib/highlight') + hljs.registerLanguage('apache', require('highlight.js/lib/languages/apache')) + hljs.registerLanguage('asciidoc', require('highlight.js/lib/languages/asciidoc')) + hljs.registerLanguage('bash', require('highlight.js/lib/languages/bash')) + hljs.registerLanguage('clojure', require('highlight.js/lib/languages/clojure')) + hljs.registerLanguage('cpp', require('highlight.js/lib/languages/cpp')) + hljs.registerLanguage('cs', require('highlight.js/lib/languages/cs')) + hljs.registerLanguage('css', require('highlight.js/lib/languages/css')) + hljs.registerLanguage('diff', require('highlight.js/lib/languages/diff')) + hljs.registerLanguage('dockerfile', require('highlight.js/lib/languages/dockerfile')) + hljs.registerLanguage('groovy', require('highlight.js/lib/languages/groovy')) + hljs.registerLanguage('haskell', require('highlight.js/lib/languages/haskell')) + hljs.registerLanguage('http', require('highlight.js/lib/languages/http')) + hljs.registerLanguage('ini', require('highlight.js/lib/languages/ini')) + hljs.registerLanguage('java', require('highlight.js/lib/languages/java')) + hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript')) + hljs.registerLanguage('json', require('highlight.js/lib/languages/json')) + hljs.registerLanguage('kotlin', require('highlight.js/lib/languages/kotlin')) + hljs.registerLanguage('makefile', require('highlight.js/lib/languages/makefile')) + hljs.registerLanguage('markdown', require('highlight.js/lib/languages/markdown')) + hljs.registerLanguage('nginx', require('highlight.js/lib/languages/nginx')) + hljs.registerLanguage('nix', require('highlight.js/lib/languages/nix')) + hljs.registerLanguage('objectivec', require('highlight.js/lib/languages/objectivec')) + hljs.registerLanguage('perl', require('highlight.js/lib/languages/perl')) + hljs.registerLanguage('php', require('highlight.js/lib/languages/php')) + hljs.registerLanguage('python', require('highlight.js/lib/languages/python')) + hljs.registerLanguage('ruby', require('highlight.js/lib/languages/ruby')) + hljs.registerLanguage('scala', require('highlight.js/lib/languages/scala')) + hljs.registerLanguage('shell', require('highlight.js/lib/languages/shell')) + hljs.registerLanguage('sql', require('highlight.js/lib/languages/sql')) + hljs.registerLanguage('swift', require('highlight.js/lib/languages/swift')) + hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml')) + hljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml')) + hljs.initHighlightingOnLoad() +})() diff --git a/src/partials/footer-scripts.hbs b/src/partials/footer-scripts.hbs index ea2a658..77f26d1 100644 --- a/src/partials/footer-scripts.hbs +++ b/src/partials/footer-scripts.hbs @@ -1,3 +1,2 @@ - - + -- 2.11.0