Search code examples
csssassweb-compiler

Sass - Web Compiler replaces Url as relatives urls


I have a problem with Web Compiler with VS2015 Update 1 and Sass.

In my Scss file, i declared some images as background.

Example :

.example {
     background-image: url(images/ex.jpg);
}

In the file compilerconfig.json, the outPutFile is not in the same directory. In the file compilerconfig.json.defaults, i set relativeUrls as false in sass section. When i compile, url becomes relative like :

.example {
         background-image: url(../../../../../images/ex.jpg);
    } 

I have the same problem with imported file.

Is there any way to resolve this ?


Solution

  • I found how to disable relative urls : the option is not to set in the file compilerconfig.json.defaults but in compilerconfig.json :

    [
      {
        "outputFile": "../../../../../inetpub/wwwroot/ui/skins/test.css",
        "inputFile": "Web/Stylesheets/test.scss",
        "minify": {
          "termSemicolons": true
        },
        "options": {
          "relativeUrls": false,
          "lineFeed": "crlf"
        }
      }
    ]