0

I've installed bootstrap

gem 'bootstrap', '~> 4.0.0.alpha3'

then I downloaded octicons from https://github.com/github/octicons/ . after extracting, I copied octicons directory to app/assets/stylesheets/. Then in application.scss I added this line:

@import "octicons/octicons.scss";

But still I cant get Octicons to work. What is the correct way to set it up for my application?

Sajad Rastegar
  • 3,014
  • 3
  • 25
  • 36
  • What's not working? Apart from the emoji not showing, do you see the CSS in your browser? Do you get 404s? – Leonel Galán Jun 14 '16 at 17:52
  • I don't get any error. I added `` in a `html.erb` file, but I can't see this icon in my browser. – Sajad Rastegar Jun 14 '16 at 17:58
  • But you do see the CSS when you inspect that element? What about the network tab? Do you see the fonts/svg files loading? EDIT: I meant errors on the browser, not Rails. – Leonel Galán Jun 14 '16 at 17:59
  • Yes, I can see the CSS when I inspect it. But in network tab I don't see any file loading. – Sajad Rastegar Jun 14 '16 at 18:03
  • Sorry, I thought you meant the html element. I can't see any CSS for Octicon in Styles tab. Also in network tab I don't see any font file loading after reloading the page. – Sajad Rastegar Jun 14 '16 at 18:26
  • Which folder did you copy again? It's either build or lib (build is compiled CSS, lib is the source SASS), but not the parent folder you clone from Github. – Leonel Galán Jun 14 '16 at 19:44
  • I downloaded this https://github.com/github/octicons/releases/download/v3.5.0/octicons.zip there was only one folder in it called `octicons` – Sajad Rastegar Jun 14 '16 at 19:50
  • That won't work. That project is an npm package that compiles SASS to CSS. Rails doesn't integrate directly with npm packages. It can, however, use SASS or CSS directly. – Leonel Galán Jun 14 '16 at 20:00

1 Answers1

1

You could use octicons-rails, instead of downloading and copying octicons manually which doesn't work with asset pipeline.

Like what the README says:

Add the following to your app/assets/stylesheets/application.scss:

*= require octicons
Larry Lv
  • 759
  • 4
  • 10
  • `octricons-rails` hasn't been updated in a couple of years (or April 2018), so it currently fails with `railties >= 5.0`, there is an open PR to fix this, **if you know what you're doing because this is potentially harmful**: you can include it with `gem 'octicons-rails', github: 'mgi166/octicons-rails', branch: 'change-railties-dependency'` – xmjw Apr 21 '18 at 17:42