/postcss-property-lookup

PostCSS plugin for property lookups, similar to Stylus

Primary LanguageJavaScriptMIT LicenseMIT

postcss-property-lookup Build Status

PostCSS plugin that allows referencing property values without a variable, similar to Stylus.

.Test {
  margin-left: 20px;
  margin-right: @margin-left;
  color: red;
  background: @color url('test.png');
}
.Test {
  margin-left: 20px;
  margin-right: 20px;
  color: red;
  background: red url('test.png');
}

Check the test fixtures for more examples.

Usage

postcss([ require('postcss-property-lookup') ])

See PostCSS docs for examples for your environment.

Options

logLevel

Type: string: <error|warn>
Required: false
Default: warn

When a lookup cannot be resolved, this specifies whether to throw an error or log a warning. In the case of a warning, the invalid lookup value will be replaced with an empty string.