Bad
20e94f05e7
This significantly reduces the bundle size(over 1MiB!) but it also uses some hacks to dynamically load browserify modules on runtime(see lazy-load-modules.js
11 lines
281 B
JavaScript
11 lines
281 B
JavaScript
const {ElemJS} = require("../basic")
|
|
const {lazyLoad} = require("../lazy-load-module")
|
|
|
|
class HighlightedCode extends ElemJS {
|
|
constructor(code) {
|
|
super(code)
|
|
lazyLoad("/static/hljs.js").then(hljs => hljs.highlightBlock(this.element))
|
|
}
|
|
}
|
|
|
|
module.exports = {HighlightedCode}
|