Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on @import rule with url containing semicolon #280

Closed
kazhashimoto opened this issue Apr 13, 2021 · 2 comments · Fixed by #322
Closed

Error on @import rule with url containing semicolon #280

kazhashimoto opened this issue Apr 13, 2021 · 2 comments · Fixed by #322
Labels
Milestone

Comments

@kazhashimoto
Copy link

Hi @macbre,

I get an error message when trying to analyze the following css file.

style.css:

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&display=swap');

body {
}

How to reproduce:

$ analyze-css --file style.css 
Error: 600&display=swap');

body is an invalid expression

Here is the log.

$ DEBUG=analyze-css* analyze-css --file style.css
analyze-css:bin analyze-css v0.13.0
analyze-css:bin argv ["/Users/hashimoto/.nodebrew/node/v14.14.0/bin/node","/Users/hashimoto/.nodebrew/current/bin/analyze-css","--file","style.css"]
analyze-css:bin opts {"offenders":true,"file":"style.css"}
analyze-css:bin runner opts: {"file":"style.css","ignoreSslErrors":false,"noOffenders":false}
analyze-css:runner Loading local CSS file: /Users/hashimoto/Desktop/error/style.css
analyze-css:preprocessors Initializing...
analyze-css opts: {"noOffenders":false,"preprocessor":false,"file":"/Users/hashimoto/Desktop/error/style.css"}
analyze-css:rules Rules to be loaded: base64, bodySelectors, childSelectors, colors, comments, complex, duplicated, emptyRules, expressions, ieFixes, import, important, length, mediaQueries, minified, multiClassesSelectors, parsingErrors, prefixes, propertyResets, qualified, specificity, stats
analyze-css:rules "base64" loaded: Reports on base64-encoded images
analyze-css:rules "bodySelectors" loaded: Reports redundant body selectors
analyze-css:rules "childSelectors" loaded: Reports redundant child nodes selectors
analyze-css:rules "colors" loaded: Reports number of unique colors used in CSS
analyze-css:rules "comments" loaded: Reports too long CSS comments
analyze-css:rules "complex" loaded: Reports too complex CSS selectors
analyze-css:rules "duplicated" loaded: Reports duplicated CSS selectors and properties
analyze-css:rules "emptyRules" loaded: Total number of empty CSS rules
analyze-css:rules "expressions" loaded: Reports CSS expressions
analyze-css:rules "ieFixes" loaded: Reports fixes for old versions of Internet Explorer (IE9 and below)
analyze-css:rules "import" loaded: Number of @import rules
analyze-css:rules "important" loaded: Number of properties with value forced by !important
analyze-css:rules "length" loaded: Length of CSS file
analyze-css:rules "mediaQueries" loaded: Reports media queries
analyze-css:rules "minified" loaded: Reports not minified CSS 
analyze-css:rules "multiClassesSelectors" loaded: Reports selectors with multiple classes
analyze-css:rules "parsingErrors" loaded: CSS parsing errors
analyze-css:prefixes Using data generated on Using autoprefixer v10.2.5
analyze-css:rules "prefixes" loaded: Reports outdated vendor prefixes
analyze-css:rules "propertyResets" loaded: Reports accidental property resets
analyze-css:rules "qualified" loaded: Reports qualified selectors
analyze-css:rules "specificity" loaded: Reports rules specificity
analyze-css:rules "stats" loaded: Emit CSS stats
analyze-css:parser Going to parse 0.10 kB of CSS
analyze-css:parser CSS parsed
analyze-css {"type":"import","import":"url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400","position":{"start":{"line":1,"column":1},"end":{"line":1,"column":75}}}
analyze-css {"type":"rule","selectors":["600&display=swap');\n\nbody"],"declarations":[],"position":{"start":{"line":1,"column":75},"end":{"line":4,"column":2}}}
analyze-css:bin Exiting with exit code #1
Error: 600&display=swap');

body is an invalid expression
@macbre macbre added the bug label Apr 13, 2021
@macbre macbre added this to the v0.13 milestone Apr 13, 2021
macbre added a commit that referenced this issue Jun 14, 2021
@macbre
Copy link
Owner

macbre commented Jun 14, 2021

See reworkcss/css#137

@macbre
Copy link
Owner

macbre commented Jun 14, 2021

We might consider migrating to https://github.com/csstree/csstree or forking npm's css module that does not seem to be actively maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants