bedrock
bedrock copied to clipboard
Decrease prototype bundle size
The prototype JS bundle size of Bedrock is 842kb.
How can we minimize the size?
Ideas
- Switch from codemirror to prism
- Remove jQuery
- ...? Suggestions welcome!
New suggestion: minify the bundle.
This could also be tied to a setting: production or development build.
I discovered CodeMirror is by far the biggest dependency, it weights 400-500kb if I recall correctly.
New suggestion: minify the CSS bundle as well.
Minification was implemented, Prism code blocks are in progress, the removing jQuery part is partially handled but needs more work.
- core-prototype-nav.js: 95kb minified
- core-style-guide.js: 126kb minified
It can be better but it's more reasonable. One problem, because of the splitting of prototype nav and core styleguide, jQuery is included twice.
If we would rewrite styleguide-search
(27 LOC) to use vanilla JS, we would be able to throw jQuery out of core-style-guide.js
and save those bytes.
Another option would be to include jQuery before everything.
rememberScroll
also uses jQuery. In 7cf5e4715a2023b5b2fcb7ae2d9782dfe0c46d00 I tried to remove it, seems to work.