Skip to content

Introduce csscomb #284

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

Merged
merged 5 commits into from
Jun 23, 2015
Merged

Introduce csscomb #284

merged 5 commits into from
Jun 23, 2015

Conversation

vast
Copy link
Contributor

@vast vast commented Jun 17, 2015

CSSComb is a tool for placing CSS properties in any specific order, so you won't have issues with double properties declarations.

Let me explain it with example:

.score {
  position: relative;
  float: left;
  margin: 13px 0;
  vertical-align: middle;
  background-color: #fff;
  border-radius: 20px;
  z-index: 10;
  font-size: 12px;
  text-align: center;
  line-height: 14px;
  font-size: 16px;
}

A developer may not spot the last font-size declaration and have an issue with element font-size. If properties are ordered:

.score {
  position: relative;
  z-index: 10;

  float: left;

  margin: 13px 0;

  text-align: center;
  vertical-align: middle;

  border-radius: 20px;
  background-color: #fff;

  font-size: 12px;
  font-size: 16px;
  line-height: 14px;
}

It's easy to spot duplicates font-size properties. It also helps in understanding how this particular code is styled. A developer sees clearly that this is a relatively positioned floating block.

At the same time, we should not include csscomb in our build process because it has some issues (see fs/static-base#56 (comment)). Instead we should rely on scss-lint.

If there is a need in violating sorting rules it can be disabled with:

// scss-lint:disable DuplicateProperty, PropertySortOrder
.foo {
  background: image-url("fallback.png") center center / cover; // IE9 fallback
  background: linear-gradient(to right, $charts-red, $charts-green 95%);
  color: $charts-green;
}

/cc @timurvafin, @rustemginiyatullin, @mikheevdmitry

@rustemginiyatullin
Copy link
Contributor

🍕 👍

@dzhebtest
Copy link

👍

@@ -2,6 +2,7 @@

## Unreleased

- Introduce [CSSComb](https://github.com/csscomb/csscomb.js)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be great to have link to this pull request with such great description!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, fixed

@vast vast force-pushed the introduce-csscomb branch from 86ebeb1 to 368b05a Compare June 19, 2015 13:42
@timurvafin
Copy link
Member

👍

@vast vast force-pushed the introduce-csscomb branch from 368b05a to 34304e5 Compare June 23, 2015 08:25
vast added a commit that referenced this pull request Jun 23, 2015
@vast vast merged commit c7e1fd8 into master Jun 23, 2015
@vast vast deleted the introduce-csscomb branch June 23, 2015 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants