twitter-bootstrap-rails on Heroku: Glyphicons displayed as squares

后端 未结 3 1531
长情又很酷
长情又很酷 2021-02-03 15:44

I have deployed a rails app on Heroku, and I am using the twitter-bootstrap-rails gem to include twitter bootstrap. Everything works perfectly locally (and in the development en

3条回答
  •  离开以前
    2021-02-03 16:28

    Fixed it. The CSS that was causing the problem:

    [class^="icon-"], [class*=" icon-"] {
    display: inline;
    width: auto;
    height: auto;
    line-height: inherit;
    vertical-align: baseline;
    background-image: none;
    background-position: 0% 0%;
    background-repeat: repeat;
    

    was part of Fontawesome, which is included by default in twitter-bootstrap-rails. The issue was that the Fontawesome icon files were not being precompiled, because they are unusual filetypes. I went into the production.rb environment file, and added '.woff', '.eot', '.svg', '.ttf' to the config.assets.precompile list. I then re-compiled my assets, and the icons showed up! Boom.

提交回复
热议问题