Skip to content

URLs resolve incorrectly in subfolders #15269

@sweetroll

Description

@sweetroll

What version of Tailwind CSS are you using?

tailwindcss 4.0.0-beta.4

What build tool (or framework if it abstracts the build tool) are you using?

vite 5.4.11
tailwindcss/vite 4.0.0-beta.4

What version of Node.js are you using?

20.17.0

What browser are you using?

Brave

What operating system are you using?

MacOS

Reproduction URL

https://github.com/sweetroll/tailwind-url-issue

Describe your issue

Adding background images to CSS files in a subfolder results in broken images. The reproduction has 4 divs, each has a background image set. Div 1 and 2 reference images in an images folder and the public folder respectively. These styles are in the main css file and work fine. Div 3 and 4 reference the same images but the styles are in a subfolder which breaks. The URLs resolve to paths using the subfolder eg. /images/vite.svg -> ./subfolder/images/vite.svg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions