nuxt webfontloader
1.0.0
บันทึกย่อ
nuxt-webfontloader เป็นการพึ่งพาโดยใช้เส้นด้ายหรือ NPM ในโครงการของคุณnuxt-webfontloader ไปยังส่วน modules ของ nuxt.config.js {
modules : [
'nuxt-webfontloader' ,
] ,
}nuxt.config.js ตัวอย่างเช่น: export default {
webfontloader : {
google : {
families : [ 'Lato:400,700' ] //Loads Lato font with weights 400 and 700
}
} ,
}nuxt.config.js ส่วนหัว: export default {
head : {
link : [
// You don't need that line anymore!
{ rel : 'stylesheet' , href : 'https://fonts.googleapis.com/css?family=Lato:400,700' }
]
}
} หากคุณต้องการใช้แบบอักษรแว่นตาที่มีตัวเลือกฟอนต์-เพลย์เป็นไปได้
แต่มีความแตกต่างเล็กน้อยหากคุณต้องการเพิ่มครอบครัวแบบอักษรเพียงตัวเดียวหรือมากกว่าหนึ่งครอบครัว
นี่เป็นตัวอย่างสำหรับการเพิ่ม หนึ่งตระกูลฟอนต์ ที่มีตัวเลือกฟอนต์-เพลย์:
export default {
webfontloader : {
google : {
// Loads Open Sans font with weights 300 and 400 + display font as swap
families : [ 'Open+Sans:300,400,600&display=swap' ]
}
} ,
}นี่เป็นตัวอย่างสำหรับการเพิ่ม ตระกูลฟอนต์เพิ่มเติม ด้วยตัวเลือกฟอนต์-เพลย์:
export default {
webfontloader : {
// add Google Fonts as "custom" | workaround required
custom : {
families : [
'Open Sans:n3,n4' ,
'Roboto:n3,n7'
] ,
urls : [
// for each Google Fonts add url + options you want
// here add font-display option
'https://fonts.googleapis.com/css?family=Open+Sans:300,400&display=swap' ,
'https://fonts.googleapis.com/css?family=Roboto:300,700&display=swap'
]
}
} ,
} yarn install หรือ npm installnpm run dev ใบอนุญาต MIT
ลิขสิทธิ์ (c) Alexander Lichter