Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Imported Less File, Appends Sub-Directory to url() styles #22

Closed
dnldpavlik opened this issue Oct 29, 2012 · 1 comment
Closed

Imported Less File, Appends Sub-Directory to url() styles #22

dnldpavlik opened this issue Oct 29, 2012 · 1 comment

Comments

@dnldpavlik
Copy link

When building the less files with the following directory structure:

Styles
Styles/Home

With main less at root of Styles and import less files in home, I would get the following result for every background-image: url().

background-image: url('Home/Home../Images/Image.jpg");

from the original:

background-image: url("../Images/Image.jpg");

I do not know why it is prefixing these items, but it is stopping me from being able to use sub-directories for my less compilation.

Not sure if this an issue with Less.js or the windows Script.

@duncansmart
Copy link
Owner

@dnldpavlik LESS has had all sort of issues with relative file paths. In the browser based version there's some logic to try and resolve relative paths, whereas in the nodejs/rhino versions they simply don't bother and you're recommended to use @variables for your paths.

See less/less.js#961:

On the server, URLs will not be re-written. For the in-browser component, URLs will only be rewritten to simulate compiling to a single root CSS directory

Because less.js-windows is mimicking the browser then the path resolution happens, but if you run into issues then go with the @variable approach.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants