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

Switching to postcss-value-parser #22

Merged
merged 1 commit into from
Dec 15, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"node": ">=12"
},
"dependencies": {
"postcss-values-parser": "^6"
"postcss-value-parser": "^4.2.0"
},
"peerDependencies": {
"postcss": "^8.3"
Expand Down
10 changes: 7 additions & 3 deletions src/onCSSDeclaration.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parse } from 'postcss-values-parser'
import valuesParser from 'postcss-value-parser'
import onCSSIdentifier from './onCSSIdentifier'
import options from './options'

Expand All @@ -7,9 +7,13 @@ const onCSSDeclaration = decl => {
const { value: originalValue } = decl

if (hasAnyRebeccapurple(originalValue)) {
const valueAST = parse(originalValue)
const valueAST = valuesParser(originalValue)

valueAST.walkType('word', onCSSIdentifier)
valueAST.walk(node => {
if (node.type === 'word') {
onCSSIdentifier(node);
}
});

const modifiedValue = String(valueAST)

Expand Down