プロジェクトにbootstrap-sassを追加し、このようにapplication.scssファイルにインポートしました
@
import "../bower_components/bootstrap-sass/assets/stylesheets/_bootstrap-compass";
.bootstrap{
@import "../bower_components/bootstrap-sass/assets/stylesheets/_bootstrap";
}
ブートストラップ コンパス ファイルには、関数があります。
@function twbs-font-path($path) {
@return font-url($path, true);
}
@function twbs-image-path($path) {
@return image-url($path, true);
}
画像とフォントのパスを設定するために使用されます。
コンパスを使用して css ファイルを作成した後、css ファイルの出力には、フォント ファイルへの次のパスが含まれます。
@font-face {
font-family: 'Glyphicons Halflings';
src: url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.eot);
src: url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.eot?#iefix) format("embedded-opentype"), url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.woff) format("woff"), url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.ttf) format("truetype"), url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format("svg");
}
ソースパスが次のようになるように変更するにはどうすればよいですか:
src: url(./fonts/bootstrap/glyphicons-halflings-regular.eot)
src の代わりに:url(/.tmp/styles/fonts/bootstrap/glyphicons-halflings-regular.eot)
application.scss はgrunt-contrib-compassによってビルドされたことに注意してください。
ありがとう。