I have to use a custom font Jameel Noori Nastaleeq in a rails 5 app. I have never worked with assets pipeline in rails before. Here are some of the steps I have taken:
fonts
folder in app/assets
, and place the extracted ttf
font file in itconfig.assets.paths << Rails.root.join("app", "assets", "fonts")
in config/application.rb
add the following in app/assets/stylesheets/couplets.scss
:
@font-face {
font-family: 'Jameel Noori Nastaleeq';
src:asset-url('JameelNooriNastaleeq.ttf') format("truetype");
}
Although there is no error/warnings, the above steps have no effect. Am I missing something.
I have already seen similar questions Custom Font not working in Rails Asset Pipeline Integrating @font-face files into rails asset pipeline but their answers were not helpful.
Complete code in my github repo
I had generated the resources using scaffold. Adding desired font-family
in app/assets/stylesheets/scaffold.scss
fixed the problem. I have updated the github repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With