Note that there are some explanatory texts on larger screens.

plurals
  1. PObootstrap-sass images not showing, or how to override a Gem path
    primarykey
    data
    text
    <p>Been struggling with this for the past 3 days to no avail. </p> <p>In my Gemfile I have:</p> <pre><code>gem 'sass-rails', '3.1.5' # there is a problem with 3.1.6 and we need to downgrade until they update it. gem "bootstrap-sass" </code></pre> <p>Bootstrap CSS works fine but it will not show the images in Development or Production mode. </p> <p>The development.log has this to say about the GET error:</p> <pre><code>GET http://localhost:3000/railsAdminApi/assets/glyphicons-halflings.png 404 (Not Found) </code></pre> <p>As you can see, it is using the project name as part of the path when it shouldn't. </p> <p>In my <code>bootstrap_and_overrides.css.scss</code> file I have this:</p> <pre><code>$iconSpritePath: asset-url("glyphicons-halflings.png", image) !default; $iconWhiteSpritePath: asset-url('glyphicons-halflings-white.png', image); </code></pre> <p>Note that I use <code>asset-url</code> instead of <code>image-path</code> as per this <a href="https://github.com/thomas-mcdonald/bootstrap-sass/issues/105" rel="nofollow">github discussion</a>.</p> <p>In any case, it doesn't matter what I put into this variable (or even if I change it back to <code>image-path</code>) the route will always stay the same, I cannot change it no matter what I try. </p> <p>If I edit the gem file's vendor/assets/stylesheets/bootstrap/_sprites.css.scss file directly (which is a horrible thing to do of course) and put in <code>'assets/'</code> instead of the Sass variable, the browser stops complaining about not finding the icon but still no image will be shown. </p> <p>It gets trickier:</p> <p>Putting the Sass variables back into _sprites.css.scss and precompiling shows the images in Production mode on my local machine (but not Development mode). However, on the remote server no combination will show the images in Production mode. </p> <p>So, looking for any help or perhaps a way to uninstall everything related to bootstrap (clean things up might be an option since I did play around with other bootstrap gems that I subsequently uninstalled on the local machine).</p> <p>Thanks.</p> <p><strong>Edit</strong></p> <p>Long story short, I had to remove RVM and install rbenv for my gems to work again. This time I went with <code>twitter-bootstrap-rails</code> which worked better, less javascript errors but I still have the same problem with the images, both for the glyphs and the fontawesome fonts. </p> <p>It seems that no matter what I put into the variables (this time it is respecting them) it always pre-pends the project path <code>railsAdminApi</code> to the path. </p> <p>In desperation I thought I could add a path in my <code>routes.rb</code> file so that the path it's looking for is accessible, something like:</p> <pre><code>get 'railsAdminApi' =&gt; 'public/' </code></pre> <p>Of course Rails complains there is no public controller, but I don't know of a way to create static routes without a controller. I even tried creating a softlink but that didn't do the trick. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload