Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree about CSS variables.

I'm unsure about the merits of nesting. Tends to make for some hard-to-read code.



Most nesting I do uses the '&' parent selector, so it's not "real" nesting.

  .a-long-class-name {
      background: firebrick;
      &:hover {
          background:  red;
      }
  }

This approach has some clear benefits (less verbose and it groups related code together) with little or no downsides.


Same, but this can definitely get long, ala

& > div, & a, & a { &:hover } etc.


Your example is a bit confusing. This would be a more idiomatic way of writing it:

  .some-class {
      > div, a {
          background: blue;
          &:hover {
              background: red;
          }
      }
  }


The solution is to not write css like this... ;)


Compared to BEM's .b-text-input__text-field or .b-select__option_selected or .media__img--rev nesting is a concise readable breath of fresh air




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: