From e508c3c012420162477317c9006c46577a4af155 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Wed, 11 Oct 2017 20:30:37 -0600 Subject: [PATCH] integrate highlight.js as vendor script - add highlight.js as dependency - add script to require highlight.js and register languages - add footer scripts partial - link to compiled highlight.js script --- package.json | 1 + src/js/vendor/highlight.js | 27 +++++++++++++++++++++++++++ src/layouts/default.hbs | 1 + src/partials/footer-scripts.hbs | 2 ++ yarn.lock | 4 ++++ 5 files changed, 35 insertions(+) create mode 100644 src/js/vendor/highlight.js create mode 100644 src/partials/footer-scripts.hbs diff --git a/package.json b/package.json index 1642c2c..722a482 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "gulp-uglify": "^3.0.0", "gulp-vinyl-zip": "^2.0.0", "handlebars": "^4.0.10", + "highlight.js": "^9.12.0", "js-yaml": "^3.10.0", "lodash.debounce": "^4.0.8", "map-stream": "^0.0.7", diff --git a/src/js/vendor/highlight.js b/src/js/vendor/highlight.js new file mode 100644 index 0000000..b32886d --- /dev/null +++ b/src/js/vendor/highlight.js @@ -0,0 +1,27 @@ +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('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('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('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('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('shell', require('highlight.js/lib/languages/shell')) +hljs.registerLanguage('sql', require('highlight.js/lib/languages/sql')) +hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml')) +hljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml')) diff --git a/src/layouts/default.hbs b/src/layouts/default.hbs index 6f502bd..f013729 100644 --- a/src/layouts/default.hbs +++ b/src/layouts/default.hbs @@ -9,5 +9,6 @@ {{{contents}}} +{{> footer-scripts}} diff --git a/src/partials/footer-scripts.hbs b/src/partials/footer-scripts.hbs new file mode 100644 index 0000000..1aca132 --- /dev/null +++ b/src/partials/footer-scripts.hbs @@ -0,0 +1,2 @@ + + diff --git a/yarn.lock b/yarn.lock index 7903a5d..214c422 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2589,6 +2589,10 @@ hawk@3.1.3, hawk@~3.1.3: hoek "2.x.x" sntp "1.x.x" +highlight.js@^9.12.0: + version "9.12.0" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e" + hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" -- 2.11.0