postcss-property-lookup

PostCSS plugin that allows referencing property values without a variable

MIT 16 个版本
安装
npm install postcss-property-lookup
yarn add postcss-property-lookup
pnpm add postcss-property-lookup
bun add postcss-property-lookup
README

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');
  line-height: 1.5;
  font-size: @(line-height)em;
}
.Test {
  margin-left: 20px;
  margin-right: 20px;
  color: red;
  background: red url('test.png');
  line-height: 1.5;
  font-size: 1.5em;
}

Check the test fixtures for more examples.

Usage

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

See PostCSS docs for examples for your environment.

Installation

$ yarn add postcss-property-lookup

Usage

JavaScript

postcss([
  require('postcss-property-lookup')(/* options */),
  // more plugins...
])

TypeScript

///<reference path="node_modules/postcss-property-lookup/.d.ts" />
import postcssPropertyLookup from 'postcss-property-lookup';

postcss([
  postcssPropertyLookup(/* options */),
  // more plugins...
])

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.

版本列表
3.0.0 2021-05-19
2.0.0 2017-07-06
1.2.1 2016-01-02
1.2.0 2016-01-01
1.1.4 2015-10-24
1.1.3 2015-10-18
1.1.2 2015-09-15
1.1.1 2015-09-08
1.1.0 2015-09-06
1.0.0 2015-09-05
0.4.0 2015-09-08
0.3.0 2015-09-05
0.2.2 2015-07-04
0.2.1 2015-05-28
0.2.0 2015-05-28
0.1.0 2015-05-23