skeletonlabs / create-skeleton-app

CLI installer for Skeleton apps and monorepo for the sites that form the templates
16 stars 5 forks source link

Remove Highlight.js dependency install #42

Closed endigo9740 closed 1 year ago

endigo9740 commented 1 year ago

Screenshot 2023-09-08 at 11 00 29 AM

While handy, we've identified that Highlight.js has updated over the last couple months and seems to be greatly inflating the final bundle size. This was brought up in this issue:

https://github.com/skeletonlabs/skeleton/issues/1381

We've also had a number of users run into this during the v2 RC testing phase. My guess is it's installing EVERY language module, instead of only those you need or want.

Given this, I'm going to recommend we temporarily remove the Highlight.js dependency to make this a manual install if folks wish to use it. A number of folks just opt to install everything without thinking or consideration for whether they will actually use it or not. Which means a lot of folks are bloating their app bundle for a feature they never use.

Once we can determine better instructions for limiting the size of Highlight, this can return.

moritzhertler commented 1 year ago

I might add that the current template only works in dev mode (see #2024). All classes imported by

import 'highlight.js/styles/github-dark.css';

will be removed by PurgeCSS during the build. The correct PurgeCSS config should be considered when this feature eventually returns.

I've also just run into this issue. After adding a code block with syntax highlighting my bundle size increased by ~900kB. I fixed it by only importing the languages I'm actually using (see highlight.js usage). I also tried dynamically importing languages which works nicely.

niktek commented 1 year ago

CSA has removed the highlightjs option now