Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Update to postcss 8 #15

Merged
merged 3 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,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 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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated but if you would like to do a bit clean up before a major bump, I suggest replacing babel-eslint by @babel/eslint-parser.

"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 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