4 ms·
There are tools you can use to avoid this problem. BEM libraries for templating languages abound. When I worked at HuffPost on the current desktop rendering eng
by acjohnson55 11y ago
There are tools you can use to avoid this problem. BEM libraries for templating languages abound. When I worked at HuffPost on the current desktop rendering engine, I designed everything to be a system of nested components within a layout, and it was a pretty simple effort to make a helper that each component automatically got that was preinitialized with the component name as the BEM block and then within the template, all you had to do was provide the BEM element names and optional modifiers, and it spit out all the necessary classes. I just grabbed a link to the first article on the main page, throw it in dev tools to see what I mean: http://www.huffingtonpost.com/entry/parts-of-persian-gulf-could-be-too-hot-for-humans-by-centurys-end_562e8d32e4b00aa54a4ac233 http://www.huffingtonpost.com/entry/parts-of-persian-gulf-co....
It's not completely free of pain points, particularly when it came to the JS, where we had to resort to some explicit usage of full BEM names. But that was very minor compared to the organizational benefits in the styles and markup.