stylus / nib

Stylus mixins, utilities, components, and gradient image generation
http://stylus.github.io/nib
MIT License
1.9k stars 250 forks source link

Image not compiling correctly #189

Closed SpencerC closed 3 years ago

SpencerC commented 11 years ago
.leather
  image "https://local-assets.pksy.io/img/dark-leather.png" 256pt 256pt
  //image "/img/dark-leather.png" 256pt 256pt
  background-position top center

Compiles to:

@import url("http://fonts.googleapis.com/css?family=Gudea:400,700,400italic");
.leather {
  background-image: url("https://local-assets.pksy.io/img/dark-leather.png");
  background-position: top center;
}
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
  .leather {
    background-image: url("https:/local-assets.pksy.io/img/dark-leather@2x.png");
    -webkit-background-size: 256pt 256pt;
    -moz-background-size: 256pt 256pt;
    background-size: 256pt 256pt;
  }
}

Note the dropped slash in the @2x URLs. Is there a work around?

ghost commented 10 years ago

+1

notslang commented 10 years ago

hmm... sounds like an issue with escaping. I'll look into this tomorrow

optikfluffel commented 10 years ago

The same happens here if I try to use //local-assets.pksy.io/img/dark-leather.png as source url then you get /local-assets.pksy.io/img/dark-leather.png in the output. :tired_face:

optikfluffel commented 10 years ago

The problem seems to be that stylus uses path.join which normalizes the path and seems to kill the // in our urls.

I opened up an issue over at stylus as well.

optikfluffel commented 10 years ago

What do you think about this approach from @Panya?