Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include a manifest.json file in rails?

I have following html code in a view whose layout is false.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link rel="manifest" href="manifest.json">

Jquery is being loaded but not the manifest.json, when I view page source and look at them I get this error:

No route matches [GET] "/manifest.json"

Even though I have included manifest.json inside the javascripts folder inside assets folder.

I also tried

<%= javascript_include_tag "manifest.json" %>

but that didn't work either..and that get routes error I tried

<%= manifest_link_tag "manifest" %>

Again that didn't work out, gave error :

undefined method `manifest_link_tag' 

I also added the manifest.json inside initializers/assets.rb but still no luck!!

like image 537
user1735921 Avatar asked Sep 15 '15 20:09

user1735921


2 Answers

I think you need to include it like this:

<link rel="manifest" href="<%= asset_path 'manifest.json' %>">
like image 181
dimakura Avatar answered Oct 02 '22 15:10

dimakura


My solution is:

= tag(:link, rel: 'manifest', href: some_path)

or

= tag(:link, rel: 'manifest', href: asset_path('manifest.json'))
like image 45
De_Vano Avatar answered Oct 02 '22 15:10

De_Vano