How can I use the compass inline image helper with an image url that is not relative?

Problem

How can I use the compass built-in helper with an image url that is not relative?

config.rb

relative_assets = false

I also commented on this completely

This code works

hdr-main.png lives in / test / images / on my local server.

.test{
$image:"hdr-main.png";
background: inline-image($image);
}

This code does not work

.test{
$image:"http://i.cdn.turner.com/cnn/.e/img/3.0/global/header/hdr-main.png";
background: inline-image($image);
}

Displays this error.

Compass was unable to compile one or more files in the project:
File not found or cannot be read: /Users/myname/test/images/http://i.cdn.turner.com/cnn/.e/img/3.0/global/header/hdr-main.png
0
source share
2 answers

, , . , , .

, $image: "hdr-main.png" as-is, config.rb, http_images_path http://i.cdn.turner.com/cnn/.e/img/3.0/global/header/.

, environment .

if environment == :production
  http_images_path = "http://i.cdn.turner.com/cnn/.e/img/3.0/global/header/"
end

CSS

compass compile -e production

, , , . , , .

+1

- Compass inline-image:

0

Source: https://habr.com/ru/post/1609476/


All Articles