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 -

  1. create folder name "fonts" inside app/assets directory , place mostlymono.ttf fonts inside fonts directory.
  2. now add line config/application.rb

    config.assets.paths << rails.root.join("app", "assets", "fonts") 
  3. 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; } 
  4. now add fonts config/initializers/assets.rb precompile additional assets.

    rails.application.config.assets.precompile += %w( mostlymono.ttf ) 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -