Can less.js handle relative paths for images?
Try quoting the URL, I always do it this way to keep it neat though,
@header-image: "../img/header.jpg";
background: url(@header-image);
Also, the URL code can be seen on github. Looks like it is added if you are running in a browser.
How can I get the right relative paths in my compiled LESS css files?
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.
Is there a way to set a common image path for LESS files?
Try using string interpolation for things like this. Look for “variable interpolation” in docs.
@base-url: "http://assets.fnord.com";
background-image: url("@{base-url}/images/bg.png");
Related Topics
CSS Sprite Techniques, CSS Background or Img's Clip
Horizontal Scrollbar Only Appearing at Bottom of Page
Overwriting Styles from Bootstrap in an Angular2 Component-Stylesheet
How to Make The New Facebook Post Embed Feature Responsive
Margin Does Not Push Down Another Margin
How to Use: Not() in Tailwind.CSS
Reactjs Change Background Image Dynamically
Most Sophisticated CSS Rendering Bug of All Time (Ie9)
Angular: Transclusion, Set Color of Svg Element
Custom CSS for Mobile Development Using Phonegap/Cordova
Overriding CSS on Github Pages Using Slate Theme
Difference Between Initial Containing Block and Viewport
How Make a Looped Animation Wait Using CSS3
Iis 7 Windows Server 2008/CSS File Not Loading Within Aspx
Using CSS Approach How to Set an Image to Fill a Path in Svg
0 as Saturation and Lightness Doesn't Work But 0% Does in Hsl/Hsla