@alawi , @herteby ,
We don't use
- FontAwesome or alike pre-compiled iconic font sets
- Bootstrap or other CSS framework/lib
We do use:
- Google fonts, while font in the load process, or failed to be loaded, we're trying to find best matching font from local visitor' fonts in descending order
- Compiled iconic fonts with only icons we need, and CSS it needs
- SASS for internal styling with auto-prefixes - Not sure if it helps to save some bytes
- Jade for Blaze templates - Not sure if it helps to save some bytes
Steps we have done:
- After dynamic import
s was introduced in Meteor 1.5 the fist idea was to swap our existing require(...)
in FlowRouter routes rules to import(...)
, in a way described here. This is the most significant optimization our app ever faced.
- Next we found most rarely used files which somehow got imported in the client/index.js
(bundle), and moved to dependent modules or replaced with alternatives where is possible (saved ~100KB)
- Momentjs, Stringjs, Diffjs, Numeraljs those heavy libs was imported to the bundle and weight around ~300KB altogether, we have tried to make those dependencies dynamically imported (and we did), but code complexity at this point with all internal async
/await
got out of the control so we decided to rollback, and have those libs in the main bundle.
- Find a way to optimize Momentjs and Stringjs turn out we have been using only 5 features of Momentjs and 2 of Stringjs, so we compiled Momentjs and Stringjs with only features we need (saved ~180KB)
- Review CSS/SASS rules (saved ~12KB)
- Remove unused/useless meteor packages - reactive-dict
, autoupdate
, es5-shim
, appcache
, mobile-experience
Final results:
- The js
file size returned from meteor app (gzipped) - 247KB (Google Chrome DevTools - Network Tab)
- The app size according to bundle-visualizer
- 607KB (Yes, not ~300KB as at the first message, we brought back some NPM packages after tests)
- The biggest packages we have now is Blaze
and jQuery
(both is tied to each other). Curious to see size of the apps with React. Anyone?