Font Awesome在本地工作,但不在Heroku上 [英] Font Awesome working locally, but not on Heroku
问题描述
也包含在我的application.css中:
* = require font awesome
当我从本地查看时,罚款和字形图标显示。当我将它上传到heroku时,图标不显示。我最初有块广场出现,但设法修复它,因为我的样式表中有一些乱码。
我做错了什么或错过了什么?
使用以下两个来源的信息解决了相同的问题(在Rails 4中): Rails Asset Pipeline 和
通过资产管道,首选这些资产的位置现在是应用/资产目录。将字体真棒的字体
文件夹移动到 app / assets
以及字体真棒js和css文件放入供应商/资产
或应用/资产
合适的javascript和样式表文件夹。
现在您需要编译生产资产,运行:
$ rake资产:预编译
$ RAILS_ENV =生产bundle exec rake资产:预编译
$ git add public / assets
$ git commit -m供应商编译的资产
然后推送到heroku
$ git push heroku master
希望这可以帮助别人绊倒这个问题。
So I Installed the font-awesome gem and everything looks good, using the latest version etc. Also included in my application.css:
*= require font awesome
When I view from local it turns out fine and the glyph-icons show up. When I upload it to heroku, the icons do not show up. I originally had the block squares show up but managed to fix it as I had some messy code in my stylesheets.
What am I doing wrong or what am I missing?
Had the same issue and resolved it (in Rails 4) using info from the following two sources: Rails Asset Pipeline and Rails Asset Pipeline for Heroku
"With the asset pipeline, the preferred location for these assets is now the app/assets directory". Move the fonts
folder for font-awesome into app/assets
and the font awesome js and css files into vendor/assets
or app/assets
appropriate javascripts and stylesheets folders.
Now you need to compile the assets for production, run:
$ rake assets:precompile
$ RAILS_ENV=production bundle exec rake assets:precompile
$ git add public/assets
$ git commit -m "vendor compiled assets"
Then push to heroku
$ git push heroku master
Hopefully this helps someone else who stumbles upon this question.
这篇关于Font Awesome在本地工作,但不在Heroku上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!