Skip to content
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

Decrease prototype bundle size #367

Open
Wolfr opened this issue Jun 8, 2021 · 5 comments
Open

Decrease prototype bundle size #367

Wolfr opened this issue Jun 8, 2021 · 5 comments

Comments

@Wolfr
Copy link
Contributor

Wolfr commented Jun 8, 2021

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!
@Wolfr
Copy link
Contributor Author

Wolfr commented Jun 9, 2021

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.

@Wolfr
Copy link
Contributor Author

Wolfr commented Jun 15, 2021

New suggestion: minify the CSS bundle as well.

@Wolfr
Copy link
Contributor Author

Wolfr commented Jul 8, 2021

Minification was implemented, Prism code blocks are in progress, the removing jQuery part is partially handled but needs more work.

@Wolfr
Copy link
Contributor Author

Wolfr commented Jul 19, 2021

  • 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.

@Wolfr
Copy link
Contributor Author

Wolfr commented Nov 16, 2021

rememberScroll also uses jQuery. In 7cf5e47 I tried to remove it, seems to work.

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

No branches or pull requests

1 participant