Reputation: 38032
How can I ensure that the SASS helpers in the sass-rails
gem generate URLs against my CDN?
I have this in my application.rb
:
config.asset_host = 'https://cdn.host.com/'
Which makes it so the head of the document has:
<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" />
However my CSS files look like this:
.splash { background: url('/assets/hero.png'); }
Upvotes: 1
Views: 915
Reputation: 34613
Are you using the image_url helper method in your SCSS file?
.splash { background: image_url('assets/hero.png'); }
This article may help you out a bit, and fwiw, if you are using SASS (as opposed to SCSS) then you might need to use image-url instead of image_url, I don't know for sure though
Update:
.splash { background: image_url('/assets/hero.png'); } // will still fetch from the localhost...
.splash { background: image_url('assets/hero.png'); } // work perfectly fine..
Upvotes: 3