JSPM

rework-variant

0.2.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q42459F
  • License MIT

Another take on variables in Rework.

Package Exports

  • rework-variant

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rework-variant) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Rework Variant

A new take on variables for Rework.

Installation

Install with npm:

npm install rework-variant

Usage

var rework = require('rework');
var variant = require('rework-variant');
rework(txt).use(variant());

Globals

The $globals rule allows variables to be referenced without a prefix:

$globals {
  blue: #2ccdec;
  orange: #f33c27;
}

a {
  color: $blue;
}

a:hover {
  color: $orange;
}

While other variable rules act as namespaces:

$colors {
  blue: #2ccdec;
  orange: #f33c27;
}

a {
  color: $colors.blue;
}

a:hover {
  color: $colors.orange;
}

Variables may be referenced in most places you'd expect:

$globals {
  phone-portrait: (min-device-width: 320px);
  phone-landscape: (min-device-width: 480px);
}

@media screen and $phone-portrait and $phone-landscape {
  body {
    some: 'stuff';
  }
}

License

MIT