css - custom fonts not working in my rails app? -
i'm trying use custom font in rails app, can't figure out i'm doing wrong. i've created folder called fonts in assets folder 2 fonts i'm using. , call 2 fonts in css file called home.css.scss.erb
css:
@font-face { font-family: 'proxima nova'; src: url('<%= asset_path(/assets/fonts/proximanova-regular.otf) %>', font); font-weight: normal; font-style: normal; } @font-face { font-family: 'gotham'; src: url('<%= asset_path(/assets/fonts/gotham-medium.ttf) %>', font); font-weight: normal; font-style: normal; }
then in config folder in application.rb i've added
config.assets.paths << "#{rails.root}/app/assets/fonts"
but still doesn't seem working.. ideas why?
i've used custom fonts before never need use asset_path
helper. using relative path in css should enough. settings similar these:
# config/application.rb config.assets.paths << rails.root.join("assets", "fonts") # css @font-face { font-family: 'proxima nova'; // no need embeded ruby code here src: url('fonts/proximanova-regular.otf') format('opentype'); font-weight: normal; font-style: normal; } @font-face { font-family: 'gotham'; src: url('fonts/gotham-medium.ttf') format('truetype'); font-weight: normal; font-style: normal; }
Comments
Post a Comment