开发者

SASS + Compass - Can't include font-face

开发者 https://www.devze.com 2023-03-21 22:30 出处:网络
I\'m trying to include three fonts: @include font-face(\"Kalisher\", font-files(\"kalisher.ttf\", truetype));

I'm trying to include three fonts:

@include font-face("Kalisher", font-files("kalisher.ttf", truetype));
@include font-face("Bark", font-files("barkbloom.ttf", truetype));
@include font-face("Bilbo", font-files("narkbilbo.ttf", truetype));

Only Kalisher gets included (no matter in what order I place them).

Any directions?

Compiled CSS:

@font-face {
  font-family: "Kalisher";
  src: url('/css/fonts/kalisher.ttf') format('truetype');
}

@font-face {
  font-family: "Bark";
  src: url('/css/fonts/barkbloom.ttf') format('truetype');
}

@font-face {
  font-family: "Bilbo";
  src: url('/css/fonts/nar开发者_开发问答kbilbo.ttf') format('truetype');
}


The Sass and compiled CSS looks fine. Check the fonts to confirm they are in fact web-fonts or not corrupted.


in your config.rb don't forget to put this line:

fonts_path = File.join(dir, 'yourPathfromYourMain.css', 'fonts')

ok then this is a sass font declaration:

@include font-face("Kalisher", font-files("kalisher.ttf", truetype));

ok the font generated

@font-face {
    font-family: "Kalisher";
    src: url('/css/fonts/kalisher.ttf') format('truetype');
}

has you can see url start by /

remove the / in the generated css file and try, you will see your font works, so my recommendation is check your config path, all your path..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号