How to use Galleria plugin with Rails 4 Pipeline

前端 未结 2 1872
礼貌的吻别
礼貌的吻别 2021-02-10 05:07

I\'ve recently had a trouble making Galleria plugin work with Rails 4 Pipeline and it took me a while to figure out how to make it work, so I wanted to share the solution in cas

2条回答
  •  野的像风
    2021-02-10 05:59

    Thank you this was absolutely amazing and exactly what I needed (I wish I'd found this before the 18 hours of hair pulling trying to get this to freaking work)!

    I'll add some more things that might be helpful to whomever:

    1) I had to change to galleria.css.scss.erb, so that it would interpolate the class-loader like this: background: url(<%= asset_path "/galleria/classic-loader.gif" %>) (not sure why, but the asset_url didn't work for me)

    2) Related, I also had to take the classic-map and loader images and put them in app/assets/images

    3) Per Galleria, the files I moved were the min.js files, not regular .js

    4) In the header of the view, I added:

    
    
    
    

    5) In the script on each view to load Galleria, I modified their instructions like such:

    Galleria.loadTheme("<%= asset_path "/galleria.classic.min.js" %>");
    

提交回复
热议问题