Skip to content

Commit

Permalink
Update to postcss 8 (postcss/postcss-color-hex-alpha#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop authored and romainmenke committed Dec 15, 2021
1 parent e49e935 commit 80a050c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
8 changes: 0 additions & 8 deletions plugins/postcss-color-hex-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ npm install postcss-color-hex-alpha --save-dev

Use [PostCSS Color Hex Alpha] to process your CSS:

```js
const postcssColorHexAlpha = require('postcss-color-hex-alpha');

postcssColorHexAlpha.process(YOUR_CSS /*, processOptions, pluginOptions */);
```

Or use it as a [PostCSS] plugin:

```js
const postcss = require('postcss');
const postcssColorHexAlpha = require('postcss-color-hex-alpha');
Expand Down
9 changes: 6 additions & 3 deletions plugins/postcss-color-hex-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@
"node": ">=10.0.0"
},
"dependencies": {
"postcss": "^7.0.27",
"postcss-values-parser": "^3.2.0"
"postcss-values-parser": "^4.0.0"
},
"peerDependencies": {
"postcss": "^8.0.0"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"postcss-tape": "^5.0.2",
"postcss": "^8.0.5",
"postcss-tape": "^6.0.0",
"pre-commit": "^1.2.2",
"rollup": "^2.7.2",
"rollup-plugin-babel": "^4.4.0"
Expand Down
12 changes: 6 additions & 6 deletions plugins/postcss-color-hex-alpha/src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import postcss from 'postcss'
import onCSSDeclaration from './onCSSDeclaration'
import options from './options'

/** Transform 4 & 8 character hex color notation in CSS. */
const postcssPlugin = postcss.plugin('postcss-color-hex-alpha', /** @type {PostCSSPluginInitializer} */ opts => {
export default function postcssColorHexAlpha(/** @type {PostCSSPluginInitializer} */ opts) {
options.preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : false

return root => {
root.walkDecls(onCSSDeclaration)
return {
postcssPlugin: 'postcss-color-hex-alpha',
Declaration: onCSSDeclaration
}
})
}

export default postcssPlugin
postcssColorHexAlpha.postcss = true

0 comments on commit 80a050c

Please sign in to comment.