Carbon/src/js/events/components.js
Bad 20e94f05e7 Lazy load highlight.js
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
2020-10-31 18:17:34 +01:00

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}