Skip to content

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

@jpcano

Description

@jpcano

Astro Info

Astro                    v4.8.4
Node                     v18.18.0
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I am using the CSS attribute background-image: url('path_to_image'); in a div inside an Astro's scoped style.
lightningcss resolves the URL of the image pointing to an inexistent file in the server (ie, "/Z1Mtyq" in the reproducible example I attached) and therefore the background image is not displayed.

If I use it in a global style, the URL of the image is resolved correctly and works as expected.

What's the expected result?

I expect lightningcss to resolve the URL in a scoped style like Astro does when I am not using lightningcss

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-5pmcku?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions