-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix(css): handle url replacing when preprocessing with lightningcss #17364
Conversation
Run & review this pull request in StackBlitz Codeflow. |
@@ -2780,6 +2780,8 @@ async function compileLightningCSS( | |||
if (urlReplacer) { | |||
const replaceUrl = await urlReplacer(dep.url, id) | |||
css = css.replace(dep.placeholder, () => replaceUrl) | |||
} else { | |||
css = css.replace(dep.placeholder, () => dep.url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the replace
function use a function as the second parameter? This seems unnecessary. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because of #16306
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the link.
This seems a bit weird, it's the first time I've come across this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
When using
preprocessCSS
with lightningcss,urlReplacer
is undefined, so the css urls should be left intact but we didn't replace the placeholder back to original in this case.(from astro) closes withastro/astro#11060 (comment)