Less を使用して、font-families を次のように定義しています。
@georgia: georgia, times, 'times new roman', 'nimbus roman no9 l', serif;
次に、ミックスインが少なくなります。
.font(@family: arial, @size: 1.0em, @lineheight: 1.0, @weight: normal, @style: normal, @variant: normal) {
font: @style @variant @weight @size~"/"@lineheight @family;
} // font
最後に、次のように使用します。
p {
.font(@georgia, 1.0em, 1.5)
}
しかし、カスタム フォントを使用してフォント ファミリを定義したいとも考えています。
@something: 'custom-font', arial, ...;
しかし、最初にカスタムフォントを登録する必要があります:
@font-face {
font-family: 'custom-font';
src:url('fonts/custom-font.eot');
src:url('fonts/custom-font.eot?#iefix') format('embedded-opentype'),
url('fonts/custom-font.woff') format('woff'),
url('fonts/custom-font.ttf') format('truetype'),
url('fonts/custom-font.svg#icon') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face
このコードをすべて繰り返さずに、フォント名とパスを渡してフォントを登録できるように、LESS mixin を作成することはできますか?
これを私のフォントミックスインと統合する方法がわかりません...
または、これを行うためのさらに良い方法があれば...
ありがとう、ミゲル