Ruby on rails 在HAML视图中包含字体图标
我试图在搜索栏的占位符中包含一个字体很棒的搜索图标,但我无法找到解决方案,也无法自己解决 到目前为止,我的代码如下所示:Ruby on rails 在HAML视图中包含字体图标,ruby-on-rails,haml,font-awesome,Ruby On Rails,Haml,Font Awesome,我试图在搜索栏的占位符中包含一个字体很棒的搜索图标,但我无法找到解决方案,也无法自己解决 到目前为止,我的代码如下所示: .container.search-customer-container %input {class: 'form-control customer-search-bar fa fa-search', placeholder: "What are you looking for?"} %i.fa-search 我的gem文件:gem'font-awesome-sass
.container.search-customer-container
%input {class: 'form-control customer-search-bar fa fa-search', placeholder: "What are you looking for?"}
%i.fa-search
我的gem文件:gem'font-awesome-sass',“~>4.5”
我尝试了一些不同的事情,但我对哈姆尔是新手,有点挣扎
感谢您事先提供的帮助。使用“gem”。安装起来很容易
在gemfile中:gem“font-awesomerails”
在application.css中:
/*
*= require font-awesome
*/
你可以走了 你的日志信息是什么?嘿,谢谢你的回复。实际上,我并没有同意你的答案,我找到了一种方法,用.erb写出来,通过.haml翻译程序运行,然后用css从中计算出来。我不允许再添加任何宝石,但谢谢你的帮助。