简体   繁体   中英

Ruby on Rails 4: Installing GEM

I am trying to install my first gem in Ruby, but am having problems with it working. I am not quite sure where I am going wrong, I am following the directions of the gem step by step. I am using Cloud9 for my ide.

The gem I am trying to install is the: wysiwyg-rails gem

I add the following line to the gem file:

gem 'wysiwyg-rails',        '1.2.5'

then I add the following to the application.css file so it looks like:

/*
 *= require froala_editor.min.css
 *= require froala_style.min.css
 *= require font-awesome
 *= require_tree .
 *= require_self
 */

And finally I add the require .js file to the application.js:

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require froala_editor.min.js
//= require plugins/tables.min.js
//= require_tree .

I run bundle install and then restart the server. When I try to load the page, I get the error: couldn't find file 'font-awesome'

However, i can see that font-awesome is installed

Using font-awesome-rails 4.2.0.0

If I remove the *= require font-awesome from the application.css, it starts up without any errors. When I view the source code, I can see the css and js files ( froala_editor) load up, but font-awesome is not one of them. Is there a step that I am missing?

Thanks!

这个问题很奇怪,原因不明,但是我很喜欢我的程序,只需添加“ font-awesome-rails” gem。

gem "font-awesome-rails"

Have you tried installing with font-awesome-less or font-awesome-sass gems to get them up and running?

It seems you are running without any sprockets (asset-pipeline). Add any of those gems, it probably run fine when serving rails s .

After bundle install , go to application.css and write this code as it follows:

@import "font-awesome-sprockets"
@import "font-awesome"

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM