GitXplorerGitXplorer
d

zcss

public
8 stars
1 forks
1 issues

Commits

List of commits on branch master.
Unverified
bc81d65b6becab2a925b4e35439203ffd3d5e8b7

handle media queries and other at rules

ddchester committed 5 years ago
Verified
8cb6bea530329c6500de3969f6db980e6cc4ab73

Update README.md

ddchester committed 5 years ago
Verified
fe4447a394daedc8cd316fafb9c532015e12ff0e

Update README.md

ddchester committed 5 years ago
Verified
0e4eeaee3b2723fd1397beb96745779acfa872d8

Update README.md

ddchester committed 5 years ago
Unverified
28dcb5a82386d89c30399718343ce08db6ce44d5

initial commit

ddchester committed 5 years ago

README

The README file for this repository.

zcss

Minimal nested CSS preprocessor in ~30 lines of pure bash!

/* button.zcss */

:root {
  --blue: #8098d4;
}

.button {
  background: var(--blue);
  border-radius: 4px;
  font-size: 18px;

  &:hover {
    transform: scale(1.1);
  }

  &[disabled] {
    opacity: 0.5
  }

  .icon {
    margin-right: 1em;
  }
}

Compile zcss to css:

$ cat button.zcss | zcss > button.css

Syntax

This preprocessor implements just two core features inspired by SCSS, Less, and the CSS Nesting draft spec -- implicit nesting, and the ampersand selector.

Implicit nesting

section {
  p {
    line-height: 2;
  }
}

/* section p {
 *   line-height: 2;
 * }
 */

Each property must be on its own line, separate from its selector.

Ampersand selector

section {
  &:hover {
    color: purple;
  }
}

/* secion:hover {
 *  color: purple;
 * }
 */

The ampersand must appear exclusively at the beginning of the selector (similarly to the & in CSS Nesting)