Optimize
How big Momo is, what your visitors really download, and the few steps that make it smaller and faster.
The sizes
| File | On disk | Sent to the browser (gzip) |
|---|---|---|
momo.min.css (everything) | about 610 KB | about 100 KB |
momo-site.min.css (no app parts) | about 550 KB | about 91 KB |
momo.js (everything) | about 505 KB | about 135 KB |
momo-site.js (no app parts) | about 360 KB | less still |
The number that matters is the last column: servers and CDNs compress text before sending it. The files are fetched once and then kept by the browser.
1. Pick the right build
A website (a landing page, a blog, a shop front) does not need the app parts. The site build leaves out the app shell, kanban, calendar, charts, inbox, comments, shortcuts, command palette, file manager, tag input and upload.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/momo-neobrut-ui@0.9.1/dist/momo-site.min.css">
<script src="https://cdn.jsdelivr.net/npm/momo-neobrut-ui@0.9.1/dist/momo-site.js" defer></script>2. Load it well
- Use the
.min.cssfile on a live site. The readablemomo.cssis for looking things up. - Put
deferon the script. The page shows first, and the script runs once the HTML is read. - Make sure compression is on. jsDelivr does it for you. On your own server, turn on gzip or brotli for CSS and JavaScript.
- Let the browser keep the files. The address has the version in it, so it can be kept for a year.
- Minify the script if you host it yourself.
momo.jsis shipped readable. Any minifier in your own build makes it noticeably smaller.
3. Fonts and icons
- Momo's fonts are self-hosted WOFF2 files beside the CSS and are only downloaded when text uses them.
- To use your own font, set
--momo-font; then Momo's font is never fetched. - Moey Icons loads only the pieces of the icon set that a page uses.
4. Your own CSS stays small
Momo sits in cascade layers (momo.base, momo.components, momo.utilities). Anything you write outside a layer wins over Momo without !important and without long selectors, so overrides are one short rule.
.card { --card-radius: 0px; } /* wins: your CSS is outside Momo's layers */5. Pictures matter more
On most pages one unprepared photo outweighs all of Momo. Give images a width and height so the page does not jump, add loading="lazy" below the first screen, and serve them at the size they are shown. See Images & figures.
What Momo already does
- No dependencies, no framework to download first.
- Components that are not on the page cost nothing at run time: each one only starts when it finds its attribute.
- Scroll and resize work is done once per frame, and long lists use the browser's own observers.
- Pop-ups use the browser's top layer in place of scripts that measure and re-stack.