服务字体上的Cloudfront与Heroku的 [英] Serving Fonts on Cloudfront with Heroku

查看:150
本文介绍了服务字体上的Cloudfront与Heroku的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立与的Cloudfront在Heroku这里下面的说明:的 https://devcenter.heroku.com/articles/using-amazon-cloudfront-cdn-with-rails

I’m trying to setup with Cloudfront on Heroku following the instructions here: https://devcenter.heroku.com/articles/using-amazon-cloudfront-cdn-with-rails

的Cloudfront是服务CSS和JS资产很好,但我不能让字体图标送达。 我有我的图标,字体,资产/字体和我加载在样式表中的字体是这样的:

Cloudfront is serving css and js assets fine, but I can’t get the font icons to be served. I have my icon font in assets/fonts and I'm loading the fonts in the stylesheet like this:

@font-face {
  src: font-url('dripicons.eot');
  ...
}

本的Cloudfront的URL没有得到prefixing以饱满的Cloudfront的URL(它缺少的子域)。它看起来是这样的:

The Cloudfront url is not getting prefixing with full Cloudfront URL (it's missing the subdomain). It looks like this:

https://.cloudfront.net/assets/dripicons-9b4649c1936652d1c1c1d18410b16ebd.eot

我试着用font_assets宝石( https://github.com/rubymaverick/font_assets )但它并没有解决问题。我使用的Rails 3.2.13。

I tried using the font_assets gem (https://github.com/rubymaverick/font_assets), but it didn't fix the issue. I'm using Rails 3.2.13.

我真的AP preciate任何输入。谢谢!

I'd really appreciate any input. Thanks!

推荐答案

如果该URL缺少您的字体它可能是一个配置问题。请验证您的环境配置文件(在这种情况下, production.rb 的)配置是否正确。从 font_assets指南

If the URL is missing for your font it could be a configuration issue. Please, verify that your environment configuration files (in this case the production.rb one) is correctly configured. From the font_assets guide:

config.font_assets.origin = 'http://coffeescript.codeschool.com'

你应该适当的原点位置的URL。

You should probably an adequate origin URL here.

这篇关于服务字体上的Cloudfront与Heroku的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆