Skip to content

rootpath does nothing to absolute url() paths #3552

@gavinbarron

Description

@gavinbarron

Minimal Reproduction using less 3.12.0

fail.less:

.fail {
    background-image: url('/images/absolute.png');
}
.works {
    background-image: url('images/relative.png');
}

run:

lessc -rp=https://mycdn/url/folder fail.less ./out.css

out.css

.fail {
  background-image: url('/images/absolute.png');
}
.works {
  background-image: url('https://mycdn/url/folder/images/relative.png');
}

Why do I want this behavior?
During development the images are served by the local web server in the /images directory.
When publishing all static elements are served out of a folder on the CDN, the folder name is variable.
This is very similar to the issue reported in #2129 but that lacked the clear detail that the image url is absolute

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions