Open
Description
I stumbled upon naming of CSS classes for instance in PHTML:
<div class="integernet_solr-products-box">
and corresponding Stylesheets:
#search_autocomplete .integernet_solr-products-box h3 {..}
At first, the existing implementation confused me, as there seems to be no proper scheme applied at all. While I guess the "integernet_solr" part is mainly a vendor prefix I would like to raise a general discussion about the way we go here. These are my thoughts:
- I find the "integernet_solr" rather long for a vendor prefix. Maybe we could come along with something shorter to not clutter up markup and classes
- What scheme should we use. In M1 version we sticked to the existing standard. In M2 I would not necessarily recommend this as it is a mess and probably prone to sooner changes. Although being my personal flavour I would suggest going with BEM using Two-Dashes-Syntax:
.block__element--modifier
- We should avoid using specificity on IDs like #search_autocomplete. When using BEM there would be other possibilities without interfering with other CSS
- As our code base is pretty manageable in terms of markup we could do great in avoiding unspecific selectors like
h3
orul.some-class-name
which makes cascading easier and saves rendering performance.