Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into wip-rewrite--courte…
Browse files Browse the repository at this point in the history
…ous-antelope-d8443985a8
  • Loading branch information
romainmenke committed Jul 22, 2023
2 parents 0a6c87a + 81a7701 commit 67fae87
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
11 changes: 6 additions & 5 deletions lib/parse-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ async function resolveImportId(result, stmt, options, state, postcss) {
postcss
)

return stmt
}

if (dataURL.isValid(stmt.from[stmt.from.length - 1])) {
return stmt
return
} else if (dataURL.isValid(stmt.from)) {
// Data urls can't be used a base url to resolve imports.
// When the parent statement has a data url
// and the current statement doesn't have a data url we ignore the statement.
return
}

const atRule = stmt.node
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
},
"devDependencies": {
"ava": "^5.0.0",
"c8": "^8.0.0",
"eslint": "^8.2.0",
"eslint-config-problems": "^7.0.0",
"eslint-plugin-prettier": "^4.0.0",
Expand All @@ -42,7 +43,7 @@
"ci": "eslint . && ava",
"lint": "eslint . --fix",
"pretest": "npm run lint",
"test": "ava"
"test": "c8 ava"
},
"eslintConfig": {
"extends": "eslint-config-problems",
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/data-url.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
/* Mixed imports: */
@import url(data:text/css;base64,QGltcG9ydCB1cmwoZm9vLmNzcyk7CgpwIHsKICBjb2xvcjogYmx1ZTsKfQo=);
@import url(data-url.css);

/* url encoded: */
@import url(data:text/css;plain,bar%20%7B%20color%3A%20green%20%7D);
@import url(data:text/css,bar%20%7B%20color%3A%20pink%20%7D);
2 changes: 1 addition & 1 deletion test/fixtures/data-url.expected.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ p { color: green; } } }@media (min-width: 320px){@layer foo{

p { color: blue; } } }/* Mixed imports: */p {
color: blue;
}p { color: pink; }
}p { color: pink; }/* url encoded: */bar { color: green }bar { color: pink }

0 comments on commit 67fae87

Please sign in to comment.