Use JSDelivr CDN for highlight.js
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

- downside: is somebody else's CDN
- upside: changes hljs download size from >1MB to 33k

Feel free to debate this.
This commit is contained in:
Cadence Ember 2020-11-05 18:00:36 +13:00
parent b74f0cc0dd
commit 1fa7da9ebb
Signed by: cadence
GPG key ID: BC1C2C61CF521B17
4 changed files with 1 additions and 9 deletions

View file

@ -19,11 +19,6 @@ module.exports = [
source: "/js/main.js",
target: "/static/bundle.js"
},
{
type: "module",
source: "/js/hljs.js",
target: "/static/hljs.js"
},
{
type: "file",
source: "/assets/fonts/whitney-500.woff",

View file

@ -40,7 +40,6 @@ html
!= JSON.stringify([...static.keys()].map(k => [k, getStatic(k)]))
| )
link(rel="stylesheet" type="text/css" href=getStatic("/sass/main.sass"))
link(rel="preload" as="script" href=getStatic("/js/hljs.js"))
script(type="module" src=getStatic("/js/main.js"))
body
main.main

View file

@ -23,7 +23,7 @@ class HighlightedCode extends ElemJS {
feel free to change the threshold number
*/
lazyLoad("./static/hljs.js").then(hljs => hljs.highlightBlock(this.element))
lazyLoad("https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10/build/highlight.min.js").then(hljs => hljs.highlightBlock(this.element))
}
}
}

View file

@ -1,2 +0,0 @@
const hljs = require("highlight.js")
module.exports = hljs