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..