in the file app/assets/config/manifest.js

//= link_tree ../images
//= link application.css

I have images in app/assets/images/

background-image: url(image_path("bg/main.jpg"));


So this is similar to the way you would access images in previous versions 
of Rails, the linking of those assets is being handled by sprockets and not 
webpacker.
 

On Sunday, 22 December 2019 20:27:45 UTC+2, fugee ohu wrote:
>
>
>
> On Sunday, December 22, 2019 at 11:12:28 AM UTC-5, Siyanda Maphumulo wrote:
>>
>> .search_button
>> {
>>   background:url(image_path("search.png"));
>> }
>>
>> more information : https://guides.rubyonrails.org/asset_pipeline.html
>>
>> On Sunday, 22 December 2019 17:15:59 UTC+2, fugee ohu wrote:
>>>
>>> How do I refer to images in stylesheets with rails 6/webpacker I always 
>>> get can't resolve image.png from code like this:
>>> .search_button
>>>
>>> .search_button
>>> {
>>>   background:url(search.png);
>>> }
>>>
>>
> Not 
> First, where should I put images Then, how to access them from 
> app/javascripts/stylesheets/application.scss
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/75443a2f-5a0d-4af7-92fb-5b2a07aeea41%40googlegroups.com.

Reply via email to