Answer the question
In order to leave comments, you need to log in
How to include icon fonts in rails?
there is an assets / fonts folder
in the scss file, I write:
@font-face {
font-family: 'glyphicons-halflings-regular';
src: font-url('glyphicons-halflings-regular.eot');
src: font-url('glyphicons-halflings-regular.eot?iefix') format('eot'),
font-url('glyphicons-halflings-regular.woff') format('woff'),
font-url('glyphicons-halflings-regular.ttf') format('truetype'),
font-url('glyphicons-halflings-regular.svg#webfont') format('svg');
}
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/
Answer the question
In order to leave comments, you need to log in
Try this:
add the (optional) ending .erb (i.e. file_name.scss.erb) to the file
next
@font-face {
font-family: 'glyphicons-halflings-regular';
src: url(<%= font_path 'glyphicons-halflings-regular.eot' %>);
src: url(<%= font_path 'glyphicons-halflings-regular.eot?iefix' %>) format('eot'),
url(<%= font_path 'glyphicons-halflings-regular.woff' %>) format('woff'),
url(<%= font_path 'glyphicons-halflings-regular.ttf' %>) format('truetype'),
url(<%= font_path 'glyphicons-halflings-regular.svg#webfont' %>) format('svg');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question