Reputation: 193
I am trying to create a rails 6 application. In rails 5 while sass was still applicable I would use image-url(xxx.png) to reference images within the asset pipeline. However, in rails 6 this is no longer applicable with web pack. I cannot seem to load up the image.
I have tried using different tags like asset-url, adjusting the url for a direct path but with no luck.
.banner { background-image: url(asset_path('home/head-banner.png')); ... }
.banner { background-image: image-url('home/head-banner.png'); ... }
The expected result is the fully hashed url for the image.
Upvotes: 2
Views: 4010
Reputation: 351
A quick fix solution that should work:
This should work without fault and will allow you to use the rails helper functions.
Upvotes: 5