Font Face Mixin for Less

前端 未结 7 539
暖寄归人
暖寄归人 2021-01-11 23:20

Using Less I am defining font-families as follows:

@georgia: georgia, times, \'times new roman\', \'nimbus roman no9 l\', serif; 

Then I ha

7条回答
  •  北海茫月
    2021-01-11 23:31

    Here's my rendition for SASS, tested and working.

    @mixin fontface($family: sans-serif, $weight: normal, $style: normal, $path: '../fonts', $filename: 'font'){ @font-face{ font-family: $family; src:url('#{$path}/#{$filename}.eot'); src:url('#{$path}/#{$filename}.eot?#iefix') format('embedded-opentype'), url('#{$path}/#{$filename}.woff') format('woff'), url('#{$path}/#{$filename}.ttf') format('truetype'), url('#{$path}/#{$filename}.svg#icon') format('svg'); font-weight: $weight; font-style: $style; } }

提交回复
热议问题