Fonts in rails 4.2.4 -
i want make rails application 'mostly mono' font ("http://www.1001fonts.com/mostlymono-font.html"), , tried asset pipeline method says here using fonts rails asset pipeline .
i placed in config/application.rb
config.assets.paths << rails.root.join("app", "assets", "fonts")
and app/assets/stylesheets/application.css
@font-face { font-family: 'mostlymono'; src: font-url('/assets/fonts/mostlymono.ttf') format('truetype'); }
is there other method or doing wrong?
you can use custom fonts bellow way -
- create folder name "fonts" inside app/assets directory , place mostlymono.ttf fonts inside fonts directory.
now add line config/application.rb
config.assets.paths << rails.root.join("app", "assets", "fonts")
now have rename app/assets/stylesheets/application.css app/assets/stylesheets/application.css.scss , place bellow code-
@font-face { font-family: "mostlymono"; src: url(asset-path("mostlymono.ttf")) format("truetype"); font-weight: normal; font-style: normal; }
now add fonts config/initializers/assets.rb precompile additional assets.
rails.application.config.assets.precompile += %w( mostlymono.ttf )
Comments
Post a Comment