Skip to content

Commit 6c62e3b

Browse files
calebebyjescalan
authored andcommitted
Add postcss-property-lookup (#35)
1 parent fe22d26 commit 6c62e3b

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ By default, the css standard plugin pack includes:
5151
- [postcss-image-set-polyfill](https://github.com/SuperOl3g/postcss-image-set-polyfill), polyfills [image-set](https://drafts.csswg.org/css-images-3/#image-set-notation) for resolution detection
5252
- [postcss-media-minmax](https://github.com/postcss/postcss-media-minmax), nice syntax sugar for media queries from [media queries level 4 spec](https://drafts.csswg.org/mediaqueries/#mq-range-context)
5353
- [postcss-nesting](https://github.com/jonathantneal/postcss-nesting), polyfill for [css nesting module level 3](http://tabatkins.github.io/specs/css-nesting/)
54+
- [postcss-property-lookup](https://github.com/simonsmith/postcss-property-lookup), sugar for referencing other properties
5455
- [postcss-pseudo-class-any-link](https://github.com/jonathantneal/postcss-pseudo-class-any-link), polyfills [:any-link pseudo-class](https://drafts.csswg.org/selectors/#any-link-pseudo)
5556
- [postcss-selector-matches](https://github.com/postcss/postcss-selector-matches), polyfills [:matches pseudo-class](https://drafts.csswg.org/selectors-4/#matches)
5657
- [postcss-selector-not](https://github.com/postcss/postcss-selector-not), polyfills [:not pseudo-class](https://drafts.csswg.org/selectors-4/#negation)
@@ -89,6 +90,7 @@ css.plugins.push(lost())
8990
| **customSelectors** | Options passed to [postcss-custom-selectors](https://github.com/postcss/postcss-custom-selectors) | |
9091
| **fontFamilySystemUi** | Options passed to [postcss-font-family-system-ui](https://github.com/JLHwung/postcss-font-family-system-ui) | |
9192
| **fontVariant** | Options passed to [postcss-font-variant](https://drafts.csswg.org/css-fonts-4/#system-ui-def) | |
93+
| **propertyLookup** | Options passed to [postcss-property-lookup](https://github.com/simonsmith/postcss-property-lookup) | |
9294
| **imageSet** | Options passed to [postcss-image-set-polyfill](https://github.com/SuperOl3g/postcss-image-set-polyfill) | |
9395
| **mediaQueriesRange** | Options passed to [postcss-media-minmax](https://github.com/postcss/postcss-media-minmax) | |
9496
| **nesting** | Options passed to [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) | |

lib/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ let colorHexAlpha = require('postcss-color-hex-alpha')
1616
let colorFunction = require('postcss-color-function')
1717
let fontFamilySystemUi = require('postcss-font-family-system-ui')
1818
let fontVariant = require('postcss-font-variant')
19+
let propertyLookup = require('postcss-property-lookup')
1920
let pseudoClassMatches = require('postcss-selector-matches')
2021
let pseudoClassNot = require('postcss-selector-not')
2122
let pseudoClassAnyLink = require('postcss-pseudo-class-any-link')
@@ -63,6 +64,7 @@ module.exports = (options = {}) => {
6364
colorFunction(options.colorFunction),
6465
fontFamilySystemUi(options.fontFamilySystemUi),
6566
fontVariant(options.fontVariant),
67+
propertyLookup(options.propertyLookup),
6668
pseudoClassMatches(options.pseudoClassMatches),
6769
pseudoClassNot(options.pseudoClassNot),
6870
pseudoClassAnyLink(options.pseudoClassAnyLink),

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"postcss-import": "^10.0.0",
2929
"postcss-media-minmax": "^3.0.0",
3030
"postcss-nesting": "^4.0.1",
31+
"postcss-property-lookup": "^2.0.0",
3132
"postcss-pseudo-class-any-link": "^4.0.0",
3233
"postcss-selector-matches": "^3.0.1",
3334
"postcss-selector-not": "^3.0.1",

test/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ test('passes fontVariant opts correctly', (t) => {
137137
undo()
138138
})
139139

140+
test('passes propertyLookup opts correctly', (t) => {
141+
const undo = cssStandardsRewired.__set__('propertyLookup', (opts) => {
142+
t.is(opts, 'test')
143+
})
144+
cssStandardsRewired({ propertyLookup: 'test' })
145+
undo()
146+
})
147+
140148
test('passes pseudoClassMatches opts correctly', (t) => {
141149
const undo = cssStandardsRewired.__set__('pseudoClassMatches', (opts) => {
142150
t.is(opts, 'test')
@@ -179,12 +187,12 @@ test('passes rucksack opts correctly', (t) => {
179187

180188
test('default plugins working', (t) => {
181189
const out = cssStandards()
182-
t.is(out.plugins.length, 23)
190+
t.is(out.plugins.length, 24)
183191
})
184192

185193
test('minify option working', (t) => {
186194
const out = cssStandards({ minify: true })
187-
t.is(out.plugins.length, 24)
195+
t.is(out.plugins.length, 25)
188196
t.is(out.plugins[out.plugins.length - 1].postcssPlugin, 'cssnano')
189197
})
190198

yarn.lock

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3608,6 +3608,14 @@ postcss-position@^0.5.0:
36083608
dependencies:
36093609
postcss "^5.0.0"
36103610

3611+
postcss-property-lookup@^2.0.0:
3612+
version "2.0.0"
3613+
resolved "https://registry.yarnpkg.com/postcss-property-lookup/-/postcss-property-lookup-2.0.0.tgz#c995d1df42a75420f2aea834c2cbe296b2c15922"
3614+
dependencies:
3615+
object-assign "^4.0.1"
3616+
postcss "^6.0.6"
3617+
tcomb "^3.2.21"
3618+
36113619
postcss-pseudo-class-any-link@^4.0.0:
36123620
version "4.0.0"
36133621
resolved "https://registry.yarnpkg.com/postcss-pseudo-class-any-link/-/postcss-pseudo-class-any-link-4.0.0.tgz#9152a0613d3450720513e8892854bae42d0ee68e"
@@ -4439,12 +4447,6 @@ strip-json-comments@~2.0.1:
44394447
version "2.0.1"
44404448
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
44414449

4442-
sugarss@^1.0.0:
4443-
version "1.0.0"
4444-
resolved "https://registry.yarnpkg.com/sugarss/-/sugarss-1.0.0.tgz#65e51b3958432fb70d5451a68bb33e32d0cf1ef7"
4445-
dependencies:
4446-
postcss "^6.0.0"
4447-
44484450
supports-color@^2.0.0:
44494451
version "2.0.0"
44504452
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
@@ -4513,6 +4515,10 @@ tar@^2.2.1:
45134515
fstream "^1.0.2"
45144516
inherits "2"
45154517

4518+
tcomb@^3.2.21:
4519+
version "3.2.24"
4520+
resolved "https://registry.yarnpkg.com/tcomb/-/tcomb-3.2.24.tgz#7f427053cc393b5997c4c3d859ca20411180887b"
4521+
45164522
term-size@^0.1.0:
45174523
version "0.1.1"
45184524
resolved "https://registry.yarnpkg.com/term-size/-/term-size-0.1.1.tgz#87360b96396cab5760963714cda0d0cbeecad9ca"

0 commit comments

Comments
 (0)