Re: [Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread fugee ohu
On Sunday, December 22, 2019 at 6:05:15 PM UTC-5, Ariel Juodziukynas wrote: > > Webpacker provides an `asset_pack_path` method > https://github.com/rails/webpacker#usage > > I guess you'll need to use a .css.erb file in order for that to work. > > # something.css.erb > > .search_button { > bac

Re: [Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread fugee ohu
On Sunday, December 22, 2019 at 6:05:15 PM UTC-5, Ariel Juodziukynas wrote: > > Webpacker provides an `asset_pack_path` method > https://github.com/rails/webpacker#usage > > I guess you'll need to use a .css.erb file in order for that to work. > > # something.css.erb > > .search_button { > bac

[Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread fugee ohu
On Sunday, December 22, 2019 at 1:50:09 PM UTC-5, Siyanda Maphumulo wrote: > > 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

[Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread fugee ohu
On Sunday, December 22, 2019 at 10:15:59 AM UTC-5, 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); > } > -- You received this

Re: [Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread Ariel Juodziukynas
Webpacker provides an `asset_pack_path` method https://github.com/rails/webpacker#usage I guess you'll need to use a .css.erb file in order for that to work. # something.css.erb .search_button { background: url('<%= asset_pack_path('images/search.png') %>'); } Lately you are asking A LOT of q

[Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread fugee ohu
Webpacker is serving images in views, I just don't know how to do it in css -- 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...@g

[Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread Siyanda Maphumulo
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

[Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread fugee ohu
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

[Rails] Re: access images in stylesheets with webpacker and rails 6

2019-12-22 Thread Siyanda Maphumulo
.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.