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

Bug with absolute urls in CSS or misconfiguration at my end? #137

Open
rj33 opened this issue Oct 24, 2017 · 0 comments
Open

Bug with absolute urls in CSS or misconfiguration at my end? #137

rj33 opened this issue Oct 24, 2017 · 0 comments

Comments

@rj33
Copy link

rj33 commented Oct 24, 2017

I'm a bit confused by the consequences of this code in css-plugin-base-builder.js

url: function(fileName, decl, from, dirname, to, options, result) {
      if ((absUrl(fileName) && fileName.charAt(0) !== '/') || fileName.match(/^%23/))
        return fileName;

I'm having trouble with absolute font paths being rewritten by the CSS plugin when bundling, so I have a font-face definition that looks like:

@font-face {
    font-family: 'ChessAlphaRegular';
    src: url('/fonts/chessalphanew-webfont.vers1.eot');
    src: url('/fonts/chessalphanew-webfont.vers1.eot?#iefix') format('embedded-opentype'),
         url('/fonts/chessalphanew-webfont.vers1.woff') format('woff'),
         url('/fonts/chessalphanew-webfont.vers1.ttf') format('truetype'),
         url('/fonts/chessalphanew-webfont.vers1.svg#ChessAlphaRegular') format('svg');
    font-weight: normal;
    font-style: normal;
    unicode-range: U+0042,U+004B,U+004E,U+0051,U+0052;
}

I'd like to keep those absolute paths as they are during processing, but the fileName.charAt(0) !== '/' is overriding the result of the absUrl test, and the code falls through to code that is transforming my absolute URL into one that is relative to the tree the bundle is being built into. Is this intended behaviour? Should I be setting rootURL to something to avoid this transformation of absolute URLs? It looks like I could avoid the absolute manipulation by making the path https://hostname.com/fonts/etcetc, but I'd really rather avoid that.

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

1 participant