简体   繁体   中英

Font awesome in Ruby on Rails Slim

I am using Font-Awesome in my ruby on rails project and I am also using the Slim html pre-processor. I am having trouble getting font-awesome to work and I know it is just an issue of me being new to Slim

Here is what I am attempting to do in HTML

<a href="#" class="hollow-btn-green">Sign Up <i class="fa fa-arrow-right"></i></a>

In my Slim file, I was thinking it would be something along the lines of this:

a.hollow-btn-green href="#" Sign Up
  i.fa.fa-arrow-right

But that doesn't seem to be working. It just outputs the literal i.fa.fa-arrow-right into the button instead of processing that to the html code.

Any idea's?

I think the problem is the Sign Up text not being escaped from formatting. Try this:

a.hollow-btn-green href="#"
    |Sign Up 
    i.fa.fa-arrow-right

You can try this, I hope this will help.

=link_to "#", class: "hollow-btn-green"
  |Sign Up
  i.fa.fa-arrow-right

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