gpt4 book ai didi

css - 如何将 compass 内联图像助手与非相对图像 url 一起使用?

转载 作者:太空宇宙 更新时间:2023-11-04 14:27:52 24 4
gpt4 key购买 nike

问题

如何使用 compass inline-image helper 图片 url 不是相对的?

配置.rb

relative_assets = false

我也试过把它完全注释掉

这段代码有效

hdr-main.png 位于我本地服务器上的 /test/images/ 中。

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

此代码有效

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

显示这个错误

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

最佳答案

我不完全确定问题出在哪里,因为您实际上并没有提出问题。您有工作代码,我假设您也在尝试呈现生产样式表。

您可能应该保留 $image: "hdr-main.png" 原样,然后使用 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编译-e制作

同样,这是假设,因为上面没有明确的问题。如果这不是您需要的,请提出具体问题。

关于css - 如何将 compass 内联图像助手与非相对图像 url 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19405493/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com