我有一个HAML布局(layout.haml)
- @fonts.each do |font|
%link{:href=>"//fonts.googleapis.com/css?family={font}",:rel=>"stylesheet",:type=>"text/css"}
Run Code Online (Sandbox Code Playgroud)
我在HAML模板index.html.haml中有这个
- @fonts = ['Lato:400,300,100','Droid+Serif:700,400'];
Run Code Online (Sandbox Code Playgroud)
当我编译时,我得到这个:
<link href='//fonts.googleapis.com/css?family={font}' rel='stylesheet' type='text/css' />
<link href='//fonts.googleapis.com/css?family={font}' rel='stylesheet' type='text/css' />
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
你忘记了哈希符号.
- @fonts.each do |font|
%link{:href=>"//fonts.googleapis.com/css?family=#{font}",:rel=>"stylesheet",:type=>"text/css"}
^ here
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
12173 次 |
最近记录: |