DEV Community

Discussion on: Your first Progressive Web App on Rails

Collapse
 
andy profile image
Andy Zhao (he/him) • Edited

Hey Ross, awesome gem. Was trying to play around with it and currently stuck on adding an icon to manifest.json.erb. What's the best way of adding in the src of the image? I tried using <%= asset_path %> but it doesn't quite work, at least not in development. Currently trying to "Add to homescreen" in development via DevTools -> Application -> Manifest.

Here's manifest.json.erb:

{
  "name": "blahblah",
  "short_name": "blahblahblah",
  "icons": [
    {
      "src": "",
      "sizes": "192x192",
      "type": "image/png"
    }
  ],
  "start_url": "/"
}

Again, not sure what to fill in for "src".

Collapse
 
rossta profile image
Ross Kaffenberger

Does image_path work? Check out how I'm using it in my sample app here.

Collapse
 
andy profile image
Andy Zhao (he/him)

Awesome! Thanks for the quick reply. Working so far :)