Skip to content

Commit

Permalink
Fix comment removal after ,
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Feb 9, 2022
1 parent 1e24638 commit 2010e24
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion lib/parser.js
Expand Up @@ -426,7 +426,11 @@ class Parser {
prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty'
next = tokens[i + 1] ? tokens[i + 1][0] : 'empty'
if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
value += token[1]
if (value.slice(-1) === ',') {
clean = false
} else {
value += token[1]
}
} else {
clean = false
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -93,7 +93,7 @@
"fs-extra": "^10.0.0",
"nanodelay": "^1.0.8",
"nanospy": "^0.5.0",
"postcss-parser-tests": "^8.4.0",
"postcss-parser-tests": "^8.5.0",
"simple-git-hooks": "^2.7.0",
"size-limit": "^7.0.8",
"strip-ansi": "^6.0.1",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2010e24

Please sign in to comment.