Ruby on rails webpacker can't find images under asset_pack_path

后端 未结 5 1643
野的像风
野的像风 2021-02-06 15:16

I have a problem with including images in my views using Ruby on Rails Webpacker. When i try to insert image in my view using html img tag and asset_pack_path i got an error. My

5条回答
  •  广开言路
    2021-02-06 15:44

    My images are located in /app/assets/images.

    Firstly add app/assets to resolved_paths: ['app/assets'] in webpacker.yml

    And then you can use the image in your JS like so:

    in CSS:

    
    

提交回复
热议问题