Skip to content

Conversation

@bluwy
Copy link
Member

@bluwy bluwy commented May 31, 2024

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)

@bluwy bluwy added feat: css p3-minor-bug An edge case that only affects very specific usage (priority) labels May 31, 2024
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

const replaceUrl = await urlReplacer(dep.url, id)
css = css.replace(dep.placeholder, () => replaceUrl)
} else {
css = css.replace(dep.placeholder, () => dep.url)
Copy link
Contributor

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. 🤔

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patak-dev patak-dev merged commit 6fbb5e0 into main Jun 3, 2024
@patak-dev patak-dev deleted the css-lightning-preprocess branch June 3, 2024 06:27
@bluwy bluwy mentioned this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: css p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lightningcss does not resolve url() inside an astro scoped style

4 participants