-
-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce syntax-highlighting support in MDEditor #568
Conversation
Bundlesize stats
|
src/utils/highlighter.js
Outdated
// 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')); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Never mind then.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Bundlesize stats
|
In order to avoid bloating the production
bundle.js
with rarely used languages.