DEV Community

Discussion on: How to use Highlight.js on a Next.js site

Collapse
 
inezabonte profile image
Ineza Bonté Grévy

Do I have to import each language that I'm using in my code snippets

Thread Thread
 
chrysillala profile image
Chrysilla Mayasari

The short answer would be yes. However, you could also import common subset of languages predefined by highlight.js using this syntax

import hljs from 'highlight.js/lib/common';
Enter fullscreen mode Exit fullscreen mode

So you won't need to import each language but this might result in bigger bundle size, compared with importing only the languages you need.