Naming classes and selectors with ECSS
Back in Chapter 3, Implementing Received Wisdom, I recognised the benefits that the BEM approach of naming CSS selectors gave us. Naming a block and then naming any child elements in relation to that block created a namespace for the child elements.
Namespacing the CSS of a module creates a form of isolation. By preventing name collisions with other elements, chunks of CSS can be more easily moved from one environment to another (from prototype to production for example). It's also far less likely that a change of styles on one selector would inadvertently affect another.
Note
There are a number of other approaches to solve the name collision problem. For example, if you are building an application with the popular React (https://facebook.github.io/react/) framework, consider Radium (https://github.com/FormidableLabs/radium) which will inline the styles for each node so you can effectively serve no CSS at all. Naturally, there are trade...