mirror of
https://github.com/hanzoai/postcss.git
synced 2026-09-24 17:01:56 +00:00
Clean up code
This commit is contained in:
+8
-3
@@ -7,6 +7,11 @@ let AtRule = require('./at-rule')
|
||||
let Root = require('./root')
|
||||
let Rule = require('./rule')
|
||||
|
||||
const SAFE_COMMENT_NEIGHBOR = {
|
||||
empty: true,
|
||||
space: true
|
||||
}
|
||||
|
||||
class Parser {
|
||||
constructor(input) {
|
||||
this.input = input
|
||||
@@ -418,9 +423,9 @@ class Parser {
|
||||
if (type === 'space' && i === length - 1 && !customProperty) {
|
||||
clean = false
|
||||
} else if (type === 'comment') {
|
||||
prev = tokens[i - 1]
|
||||
next = tokens[i + 1]
|
||||
if (prev && next && prev[0] !== 'space' && next[0] !== 'space') {
|
||||
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]
|
||||
} else {
|
||||
clean = false
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@
|
||||
"size-limit": [
|
||||
{
|
||||
"path": "lib/postcss.js",
|
||||
"limit": "16 KB"
|
||||
"limit": "17 KB"
|
||||
}
|
||||
],
|
||||
"eslintConfig": {
|
||||
|
||||
Reference in New Issue
Block a user