Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider renaming hack classes namespace from "_" to "h-" #38

Open
renatodeleao opened this issue Apr 25, 2019 · 2 comments
Open

Consider renaming hack classes namespace from "_" to "h-" #38

renatodeleao opened this issue Apr 25, 2019 · 2 comments

Comments

@renatodeleao
Copy link
Collaborator

renatodeleao commented Apr 25, 2019

Reasons:

  1. Consistency with other namespaces
  2. _ looks like lodash
  3. _ looks an element that is missing its block (BEM)
  4. _ looks like fake private vars in javascript

Cons:

  1. h- is not immediately recognisable, but we may argue that non of the others is

Alternatives:

  • hk- but i looks like hong kong
  • hack- is not that long and is explicit, so bonus points for clarity, but minus on consistency.
@tomasmcm
Copy link
Member

@renatodeleao why can't they be utilities?

@renatodeleao
Copy link
Collaborator Author

Well they can but, but usually they don't fall in the same category.

  • Hacks are usually a signal of bad css or temporary workaround, not permanent as utilties

  • First they aren't single declaration by nature. 99% of utilities are (or should be).

  • The fact that they look different/ugly _my-hack-class triggers the spider of other developers "🤔 something's not right here"

  • At the moment the only hack that we have is that workaround for min-height flex bug in Internet Explorer, and it could be an utility but then people would question its usage "the why it's there"

    <!-- this is applying a min-heigh to c-somecompnent, no questions asked -->
    <div class="c-somecomponent u-flex-min-height">
      <div class="c-hero">
     
    <!-- this is applying min-height to c-somecomponent, 🤔 but why the ugly duck name? -->
    <div class="c-somecomponent _flex-min-height">
      <div class="c-hero">
  • The guru Roberts, also says to one off hacks related to component, but i don't buy it:

// Roberts example
@media screen and (max-width: 30em) {

  /**
   * We need to force the footer to be a fixed height on smaller screens.
   */
  ._c-footer-mobile {
    height: 80px;
  }

}
// me
@media screen and (max-width: 30em) {

  /**
   * Well if We need to force the footer, that's part of the component so
   */
  .c-footer {
    height: 80px;
  }
}

This is more like a meta question, but thanks for your interest!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants