0

I recently started using parcelJS to build and I'm pretty new to Webpack and such tools. I use the highlighJS library to highlight some syntax on my page and I'm importing it using the line below.

import hljs from 'highlight.js/lib/highlight';

This library also has languages that to highlight the syntax which can be imported using:

import python from 'highlight.js/lib/languages/python';

Is there a way to import all of the languages in the folder instead of importing them one by one?

Farzan
  • 607
  • 1
  • 8
  • 27
  • 1
    have you tried just `import hljs from 'highlight.js'`? their documentation says 'The default import imports all languages!' so it may work – skyboyer Oct 07 '18 at 11:27

1 Answers1

0

Using import hljs from 'highlight.js' imports all the languages and functions in highlightJS when using hljs.highlightBlock(vnode.dom); syntax is automatically detected and highlighted and there is no need to register a language.

Farzan
  • 607
  • 1
  • 8
  • 27