Use JSDelivr CDN for highlight.js
- 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:
parent
b74f0cc0dd
commit
1fa7da9ebb
4 changed files with 1 additions and 9 deletions
5
spec.js
5
spec.js
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
const hljs = require("highlight.js")
|
||||
module.exports = hljs
|
Loading…
Reference in a new issue