5

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:

  1. create fonts folder in app/assets, and place the extracted ttf font file in it
  2. add config.assets.paths << Rails.root.join("app", "assets", "fonts") in config/application.rb
  3. 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

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

@Todd: add your own answer if you desire, but please don't vandalize this one

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.