Skip to content

Commit 4cb606c

Browse files
yannbfnickserv
andauthored
feat: import parse directly from css (#415)
- This will avoid having to access `fs` which will break in browser environments Co-authored-by: Nick McCurdy <nick@nickmccurdy.com>
1 parent 35ab97d commit 4cb606c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import redent from 'redent'
2-
import {parse} from 'css'
2+
import cssParse from 'css/lib/parse'
33
import isEqual from 'lodash/isEqual'
44

55
class GenericTypeError extends Error {
@@ -100,7 +100,7 @@ class InvalidCSSError extends Error {
100100
}
101101

102102
function parseCSS(css, ...args) {
103-
const ast = parse(`selector { ${css} }`, {silent: true}).stylesheet
103+
const ast = cssParse(`selector { ${css} }`, {silent: true}).stylesheet
104104

105105
if (ast.parsingErrors && ast.parsingErrors.length > 0) {
106106
const {reason, line} = ast.parsingErrors[0]

0 commit comments

Comments
 (0)