@ font-face rails 3.2

I was thinking about using font-squirrels in my rails application using @ font-face. Hope this is the right way to explain this. I'm relatively new to this, so I was hoping someone could advise how I can get this to work in the rails application

thanks

+7
source share
2 answers

Okay, so I thought I would give an answer so that he could help other people in my situation. I just looked for it and collected all the pieces, I was lazy / afraid of the unknown on this, so I apologize for that. Just trying to figure it out really helps.

Anyway

1) Create a folder called fonts in the application / assets
2) Put all svg.eot.woff.ttf in this folder
3) In config / application.rb enter the following

# Add the fonts path config.assets.paths << "#{Rails.root}/app/assets/fonts" # Precompile additional assets config.assets.precompile += %w( .svg .eot .woff .ttf ) 

4) In the application stylesheets you put @ font-face styles, for example

  @font-face { font-family: 'DearestRegular'; src: url('Dearest-webfont.eot'); src: url('Dearest-webfont.eot?#iefix') format('embedded-opentype'), url('Dearest-webfont.woff') format('woff'), url('Dearest-webfont.ttf') format('truetype'), url('Dearest-webfont.svg#DearestRegular') format('svg'); font-weight: normal; font-style: normal; 

}

5) Then wherever you want to use the font, just use font-family as usual 6) Oh and restart the server to collect all this :)

+23
source
+1
source

All Articles