1 つの Rails アプリケーションで Google のフォントを使用する必要があります。通常の HTML コードは、次のように googlefonts の使用法を定義します。
<link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic' rel='stylesheet' type='text/css'>
alpplication.html.erb に同じ行を追加しようとしましたが、うまくいきませんでした。次に、@font-face 定義を (link-href が指す場所から) 別の css.scss ファイルに抽出し、そのファイルをマニフェスト css ファイルに含めました。
#googlefonts.css.scss
@font-face {
font-family: 'PT Sans';
font-style: italic;
font-weight: 400;
src: local('PT Sans Italic'), local('PTSans-Italic'), url(http://themes.googleusercontent.com/static/fonts/ptsans/v4/xxxx.woff) format('woff');
}
#application.css
*= require googlefonts
*= require_tree .
それは再び起こりませんでした。
パズルを解くのを手伝ってください。Rails 3アプリケーションでGoogleでホストされているフォントを使用するベストプラクティスは何ですか?
編集: @font-face 定義を参照する私の css は次のとおりです。
#styles.css.scss
body{
font-family: "PT Sans", Arial, Helvetica, sans-serif;
font-size:13px;
line-height:25px;
text-shadow:none !important;
color:#444;
}