Unused CSS code: identification and clean up
summary
Booking.com finds ~50K CSS selectors across pages and cannot rely on static analysis or manual testing across ~2K scenarios, so it builds in-browser CSS coverage via crowdsourced sessions: inject stylesheet text to bypass cross-origin limits, test selectors during idle time with requestIdleCallback and a setTimeout fallback, batch reports via service workers, normalize selector order, and handle third‑party rules. Removal of ~5k page‑specific selectors saves 85KB gzipped, speeds first paint ~120ms, and is validated with A/B testing.
AI-written summary · about
chapters (10)
- 0:00Introduction to unused CSS
- 3:17Why unused CSS matters
- 8:15Impact on developer experience
- 12:31Crowdsourced CSS coverage approach
- 18:37Testing selectors efficiently
- 21:27Challenges in data collection
- 25:04Results of unused CSS identification
- 28:48A/B testing clean CSS
- 31:20When to address unused CSS
- 32:54Q&A on CSS cleanup








