Skip to content

Commit 38aec9b

Browse files
goto-bus-stopjonathantnealromainmenke
committed
* update to postcss 8 * Update package.json Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> Co-authored-by: Jonathan Neal <jonathantneal@hotmail.com> Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com>
1 parent 516c5d2 commit 38aec9b

File tree

4 files changed

+15
-24
lines changed

4 files changed

+15
-24
lines changed

plugins/postcss-color-functional-notation/README.md

-8
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ npm install postcss-color-functional-notation --save-dev
3636

3737
Use [PostCSS Color Functional Notation] to process your CSS:
3838

39-
```js
40-
const postcssColorFunctionalNotation = require('postcss-color-functional-notation');
41-
42-
postcssColorFunctionalNotation.process(YOUR_CSS /*, processOptions, pluginOptions */);
43-
```
44-
45-
Or use it as a [PostCSS] plugin:
46-
4739
```js
4840
const postcss = require('postcss');
4941
const postcssColorFunctionalNotation = require('postcss-color-functional-notation');

plugins/postcss-color-functional-notation/package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@
2626
"node": ">=10.0.0"
2727
},
2828
"dependencies": {
29-
"postcss": "^7.0.27",
30-
"postcss-values-parser": "^3.2.0"
29+
"postcss-values-parser": "^5.0.0"
30+
},
31+
"peerDependencies": {
32+
"postcss": "^8.0.0"
3133
},
3234
"devDependencies": {
3335
"@babel/core": "^7.9.0",
3436
"@babel/preset-env": "^7.9.5",
3537
"babel-eslint": "^10.1.0",
3638
"eslint": "^6.8.0",
37-
"postcss-tape": "^5.0.2",
39+
"postcss": "^8.0.5",
40+
"postcss-tape": "^6.0.0",
3841
"pre-commit": "^1.2.2",
3942
"rollup": "^2.7.2",
4043
"rollup-plugin-babel": "^4.4.0"
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import postcss from 'postcss'
21
import onCSSDeclaration from './onCSSDeclaration'
32
import options from './options'
43

54
/** Transform space and slash separated color functions in CSS. */
6-
const postcssPlugin = postcss.plugin('postcss-color-functional-notation', opts => {
5+
export default function postcssColorFunctionalNotation(opts) {
76
options.preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : false
87

9-
return root => {
10-
root.walkDecls(onCSSDeclaration)
8+
return {
9+
postcssPlugin: 'postcss-color-functional-notation',
10+
Declaration: onCSSDeclaration
1111
}
12-
})
12+
}
1313

14-
export default postcssPlugin
14+
postcssColorFunctionalNotation.postcss = true
1515

16-
/** @typedef {import('postcss').Root} CSSRoot */
17-
/** @typedef {(root: CSSRoot) => void} PostCSSTransformCallback */
18-
/** @typedef {(opts: options) => PostCSSTransformCallback} PostCSSPluginInitializer */
16+
/** @typedef {import('postcss').Root} CSSRoot */
17+
/** @typedef {(root: CSSRoot) => void} PostCSSTransformCallback */
18+
/** @typedef {(opts: options) => PostCSSTransformCallback} PostCSSPluginInitializer */

plugins/postcss-color-functional-notation/src/onCSSFunction.js

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ const onCSSFunction = node => {
1010
const isRgbWithNumbers = isRgbColorFunctionName(name) && isRgbNumberFunctionContents(nodes)
1111
const isRgbWithPercents = isRgbColorFunctionName(name) && isRgbPercentFunctionContents(nodes)
1212

13-
if (name === 'hsl' && !isHsl) {
14-
console.log([name, isHue(nodes[0])], nodes[0])
15-
}
16-
1713
if (isHsl || isRgbWithNumbers || isRgbWithPercents) {
1814
// rename the Color function to `hsl` or `rgb`
1915
Object.assign(node, { name: isHsl ? 'hsl' : 'rgb' })

0 commit comments

Comments
 (0)