Remove dependency on cssesc

Makes it easier to guarantee that our escape behavior stays in line with postcss-selector-parser if their internal implementation ever changes.
This commit is contained in:
Adam Wathan 2019-02-27 16:40:19 -05:00
parent 2f79cab8fa
commit 5e935c10f7
2 changed files with 5 additions and 3 deletions

View File

@ -44,7 +44,6 @@
"autoprefixer": "^9.4.5",
"bytes": "^3.0.0",
"chalk": "^2.4.1",
"cssesc": "^3.0.0",
"fs-extra": "^4.0.2",
"lodash": "^4.17.11",
"node-emoji": "^1.8.1",

View File

@ -1,5 +1,8 @@
import cssesc from 'cssesc'
import parser from 'postcss-selector-parser'
import get from 'lodash/get'
export default function escapeClassName(className) {
return cssesc(className, { isIdentifier: true })
const node = parser.className()
node.value = className
return get(node, 'raws.value', node.value)
}