Official way of adding custom fonts to Rails 4?

前端 未结 5 538
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-08 04:37

I\'m researching how to add custom fonts to my Rails app, e.g. by adding a fonts folder in the assets folder - and I cannot find an \"official\" Rails way on ho

5条回答
  •  青春惊慌失措
    2020-12-08 05:13

    Just did it...

    1. Download and save the font files (eot, woff, woff2...) in your assets/fonts/ directory

      1. In your config/application.rb add this line config.assets.paths << Rails.root.join("app", "assets", "fonts")

    What this does is it precompiles your fonts folder just as it does by default with your images, stylesheets etc.

    1. and make sure this line is set to true config.assets.enabled = true

    2. In your sass/scss or even inline with

提交回复
热议问题