I’m having a problem with LESS breaking relative URLs in my compiled files. For example, I have;
├── style.less
├── style.css
├── assets
│ ├── img
│ │ └── bg.png
│ ├── less
│ │ └── included.less
Style.less imports included.less which has the following line;
body {background: url(../img/wall-texture.png);}
But the output in style.css becomes
body {background: url(assets/less/assets/less/../img/wall-texture.png);}
What’s going on here, and how can I fix this so that my paths remain correct after compiling? I realize that perhaps my relative path in included.less needs to be adjusted, and that’s fine, but currently, with how less is doubling “assets/less” it makes it extremely convoluted to get the right path while maintaining a reasonable folder structure. Besides that I’m using git submodules to include different LESS projects, so I don’t really want to change either the code in the less files or the folder structure, I just want to coerce LESS into compiling correctly. (I’ve tried all of the Windows compilers I can find, and they all behave the same.)
Any help greatly appreciated!
Have a look at https://github.com/marklagendijk/WinLess/issues/12
It seems to be related with exactly the version you are using (1.5.3). I recommend to update to the latest winless build which is already 1.8.0.
There have been several issues with relative paths along the way of winless. But most of them seem to be fixed. See also https://github.com/marklagendijk/WinLess/issues/search?q=path
Please note that the default behavior of the less compiler is actual to retain the relative path as you would expect.