FlipperPA / wagtailcodeblock

StreamField code blocks for the Wagtail CMS with real-time PrismJS Syntax Highlighting.
BSD 3-Clause "New" or "Revised" License
156 stars 29 forks source link

PrismJS extremely slow #16

Closed krystianmagdziarz closed 5 years ago

krystianmagdziarz commented 5 years ago

Hi, What I can do to increase loading time prism.js file on the frontend? According to Google Speed Insight it takes 3 383 ms to load this file.

FlipperPA commented 5 years ago

It's a tricky problem. I include the entire payload of PrismJS so support all languages, line numbers, and so on.

If you only want to support a few languages, you could go to the PrismJS website and build your own, only including those languages. Then create a yourapp/static/js/prism.min.js within one of your other apps that is included in INSTALLED_APPS before wagtailcodeblock.

See this answer on Stack Overflow for more details: https://stackoverflow.com/questions/21982260/how-to-override-grappelli-js-file-in-django