Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails SASS文件中未使用Rails CDN URL_Ruby On Rails_Ruby_Sass_Asset Pipeline - Fatal编程技术网

Ruby on rails SASS文件中未使用Rails CDN URL

Ruby on rails SASS文件中未使用Rails CDN URL,ruby-on-rails,ruby,sass,asset-pipeline,Ruby On Rails,Ruby,Sass,Asset Pipeline,如何确保SASS-railsgem中的SASS-helpers根据我的CDN生成url 我在我的应用程序中有这个。rb: config.asset_host = 'https://cdn.host.com/' 因此,文件的标题有: <link href="https://cdn.host.com/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" /> <link href="https://cdn

如何确保
SASS-rails
gem中的SASS-helpers根据我的CDN生成url

我在我的
应用程序中有这个。rb

config.asset_host = 'https://cdn.host.com/'
因此,文件的标题有:

<link href="https://cdn.host.com/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<link href="https://cdn.host.com/assets/application.css" rel="stylesheet" type="text/css" />

您是否在SCSS文件中使用image\u url助手方法

.splash { background: image_url('assets/hero.png'); }
可能会对您有所帮助,而且fwiw,如果您使用的是SASS(而不是SCSS),那么您可能需要使用image-url而不是image\u-url,不过我不确定

更新:

.splash { background: image_url('/assets/hero.png'); }  // will still fetch from the localhost...
 .splash { background: image_url('assets/hero.png'); }  // work perfectly fine..

对我来说,从使用图像url切换到使用图像url就成功了。我可以保留斜杠。
.splash { background: image_url('/assets/hero.png'); }  // will still fetch from the localhost...
 .splash { background: image_url('assets/hero.png'); }  // work perfectly fine..