Modular & reusable front end code
summary
Argues for building front-end code as independent modules: use HTML5 sectioning (multiple H1s OK) and Modernizr for older IE, scope styles with a mod- prefix and shallow selectors, keep media queries inside each module, and store one Sass/JS file per module (one-file-per-module), assembled with Sprockets. Use classes for CSS, IDs only for JS, and prefer data- attributes for grouping. Benchmarks show finding by class is only ~5% faster than by data-attributes in Chrome and mobile devices still handle dozens of queries per second, so data-attributes are practical.
AI-written summary · about
chapters (9)
- 0:00The philosophy of modules
- 5:08Front-end modularity
- 6:50HTML5 and semantic structure
- 10:25Modular CSS styling
- 13:19Naming and scoping modules
- 16:09Generic and modifier modules
- 18:23Media queries and design
- 21:05Behavior with JavaScript
- 26:44File architecture and Q&A








