Skip to content

Conversation

@ashmaroli
Copy link
Member

In order to avoid bloating the production bundle.js with rarely used languages.

@ashmaroli
Copy link
Member Author

Bundlesize stats

branch bundle.js bundle.js.map
master 2.24MB 6.74MB
PR 1.76MB 6.02MB

// hljs.registerLanguage('x86asm', require('highlight.js/lib/languages/x86asm'));
// hljs.registerLanguage('xl', require('highlight.js/lib/languages/xl'));
// hljs.registerLanguage('xquery', require('highlight.js/lib/languages/xquery'));
hljs.registerLanguage('zephir', require('highlight.js/lib/languages/zephir'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can store keys of languages we want to support in an array constant then register them in a loop.
It would be easier to see which languages are enabled that way.

Copy link
Member Author

@ashmaroli ashmaroli Dec 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, we can. But webpack won't evaluate the require code then and consequently include all languages in the bundle. To avoid that, we'll have to additionally configure webpack to remove the unneeded languages..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Never mind then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are the couple of languages that I'm suggesting we don't need to support:

  • zephir
  • tcl
  • vbscript-html
  • qml
  • q
  • purebasic
  • processing
  • openscad
  • moonscript

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ashmaroli
Copy link
Member Author

Bundlesize stats

branch bundle.js bundle.js.map
master 2.22MB 6.73MB
PR 1.75MB 6.00MB

@ashmaroli ashmaroli merged commit e3c1060 into jekyll:master Dec 30, 2019
@ashmaroli ashmaroli deleted the highlightjs-lite branch December 30, 2019 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants