(nuxt) move scss variables to config.style which then renders them as css custom properties

This commit is contained in:
Valentyne Stigloher 2025-01-12 18:28:53 +01:00
parent 5fa3d0e818
commit 66627a8212
74 changed files with 384 additions and 325 deletions

View File

@ -14,9 +14,16 @@ const colour = '#C71585';
useHead({
htmlAttrs: {
dir: config.dir || 'ltr',
dir: config.style.dir || 'ltr',
lang: config.locale,
},
style: [{
textContent:
`:root {
--font-headings: ${config.style.fontHeadings.join(', ')};
--font-text: ${config.style.fontText.join(', ')};
}`,
}],
link: [
{ rel: 'icon', sizes: '48x48', href: '/favicon.ico' },
{ rel: 'icon', sizes: 'any', type: 'image/svg', href: '/logo/logo-primary.svg' },

View File

@ -1,239 +1,236 @@
@use "sass:list";
@use "./variables";
@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap');
// We're using google-webfonts-helper https://gwfh.mranftl.com/fonts to self-host fonts
@if list.index($fonts, 'Quicksand') {
/* quicksand-regular - latin-ext_latin */
@font-face {
font-family: 'Quicksand';
font-style: normal;
font-weight: 400;
src: url('/fonts/quicksand-v21-latin-ext_latin-regular.eot'); /* IE9 Compat Modes */
src: local('Quicksand'),
url('/fonts/quicksand-v21-latin-ext_latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/quicksand-v21-latin-ext_latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/quicksand-v21-latin-ext_latin-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/quicksand-v21-latin-ext_latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/quicksand-v21-latin-ext_latin-regular.svg#Quicksand') format('svg'); /* Legacy iOS */
}
/* quicksand-700 - latin-ext_latin */
@font-face {
font-family: 'Quicksand';
font-style: normal;
font-weight: 700;
src: url('/fonts/quicksand-v21-latin-ext_latin-700.eot'); /* IE9 Compat Modes */
src: local('Quicksand'),
url('/fonts/quicksand-v21-latin-ext_latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/quicksand-v21-latin-ext_latin-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/quicksand-v21-latin-ext_latin-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/quicksand-v21-latin-ext_latin-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/quicksand-v21-latin-ext_latin-700.svg#Quicksand') format('svg'); /* Legacy iOS */
}
/* quicksand-regular - latin-ext_latin */
@font-face {
font-family: 'Quicksand';
font-style: normal;
font-weight: 400;
src: url('/fonts/quicksand-v21-latin-ext_latin-regular.eot'); /* IE9 Compat Modes */
src: local('Quicksand'),
url('/fonts/quicksand-v21-latin-ext_latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/quicksand-v21-latin-ext_latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/quicksand-v21-latin-ext_latin-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/quicksand-v21-latin-ext_latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/quicksand-v21-latin-ext_latin-regular.svg#Quicksand') format('svg'); /* Legacy iOS */
}
/* quicksand-700 - latin-ext_latin */
@font-face {
font-family: 'Quicksand';
font-style: normal;
font-weight: 700;
src: url('/fonts/quicksand-v21-latin-ext_latin-700.eot'); /* IE9 Compat Modes */
src: local('Quicksand'),
url('/fonts/quicksand-v21-latin-ext_latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/quicksand-v21-latin-ext_latin-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/quicksand-v21-latin-ext_latin-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/quicksand-v21-latin-ext_latin-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/quicksand-v21-latin-ext_latin-700.svg#Quicksand') format('svg'); /* Legacy iOS */
}
@if list.index($fonts, 'Nunito') {
/* nunito-regular - latin-ext_latin_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Nunito';
font-style: normal;
font-weight: 400;
src: url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.svg#Nunito') format('svg'); /* Legacy iOS */
}
/* nunito-700 - latin-ext_latin_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Nunito';
font-style: normal;
font-weight: 700;
src: url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.svg#Nunito') format('svg'); /* Legacy iOS */
}
/* nunito-regular - latin-ext_latin_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Nunito';
font-style: normal;
font-weight: 400;
src: url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-regular.svg#Nunito') format('svg'); /* Legacy iOS */
}
/* nunito-700 - latin-ext_latin_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Nunito';
font-style: normal;
font-weight: 700;
src: url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-700.svg#Nunito') format('svg'); /* Legacy iOS */
}
@if list.index($fonts, 'Zen Maru Gothic') {
/* zen-maru-gothic-regular - latin_japanese */
@font-face {
font-family: 'Zen Maru Gothic';
font-style: normal;
font-weight: 400;
src: url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.svg#ZenMaruGothic') format('svg'); /* Legacy iOS */
}
/* zen-maru-gothic-700 - latin_japanese */
@font-face {
font-family: 'Zen Maru Gothic';
font-style: normal;
font-weight: 700;
src: url('/fonts/zen-maru-gothic-v4-latin_japanese-700.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.svg#ZenMaruGothic') format('svg'); /* Legacy iOS */
}
/* zen-maru-gothic-regular - latin_japanese */
@font-face {
font-family: 'Zen Maru Gothic';
font-style: normal;
font-weight: 400;
src: url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/zen-maru-gothic-v4-latin_japanese-regular.svg#ZenMaruGothic') format('svg'); /* Legacy iOS */
}
/* zen-maru-gothic-700 - latin_japanese */
@font-face {
font-family: 'Zen Maru Gothic';
font-style: normal;
font-weight: 700;
src: url('/fonts/zen-maru-gothic-v4-latin_japanese-700.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/zen-maru-gothic-v4-latin_japanese-700.svg#ZenMaruGothic') format('svg'); /* Legacy iOS */
}
@if list.index($fonts, 'Nanum Gothic') {
/* nanum-gothic-regular - latin_korean */
@font-face {
font-family: 'Nanum Gothic';
font-style: normal;
font-weight: 400;
src: url('/fonts/nanum-gothic-v17-latin_korean-regular.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/nanum-gothic-v17-latin_korean-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/nanum-gothic-v17-latin_korean-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/nanum-gothic-v17-latin_korean-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/nanum-gothic-v17-latin_korean-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/nanum-gothic-v17-latin_korean-regular.svg#NanumGothic') format('svg'); /* Legacy iOS */
}
/* nanum-gothic-700 - latin_korean */
@font-face {
font-family: 'Nanum Gothic';
font-style: normal;
font-weight: 700;
src: url('/fonts/nanum-gothic-v17-latin_korean-700.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/nanum-gothic-v17-latin_korean-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/nanum-gothic-v17-latin_korean-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/nanum-gothic-v17-latin_korean-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/nanum-gothic-v17-latin_korean-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/nanum-gothic-v17-latin_korean-700.svg#NanumGothic') format('svg'); /* Legacy iOS */
}
/* nanum-gothic-regular - latin_korean */
@font-face {
font-family: 'Nanum Gothic';
font-style: normal;
font-weight: 400;
src: url('/fonts/nanum-gothic-v17-latin_korean-regular.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/nanum-gothic-v17-latin_korean-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/nanum-gothic-v17-latin_korean-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/nanum-gothic-v17-latin_korean-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/nanum-gothic-v17-latin_korean-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/nanum-gothic-v17-latin_korean-regular.svg#NanumGothic') format('svg'); /* Legacy iOS */
}
/* nanum-gothic-700 - latin_korean */
@font-face {
font-family: 'Nanum Gothic';
font-style: normal;
font-weight: 700;
src: url('/fonts/nanum-gothic-v17-latin_korean-700.eot'); /* IE9 Compat Modes */
src: local(''),
url('/fonts/nanum-gothic-v17-latin_korean-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/nanum-gothic-v17-latin_korean-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/nanum-gothic-v17-latin_korean-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/nanum-gothic-v17-latin_korean-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/nanum-gothic-v17-latin_korean-700.svg#NanumGothic') format('svg'); /* Legacy iOS */
}
@if list.index($fonts, 'Noto Sans TC') {
/* noto-sans-tc-regular - latin_chinese-traditional */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Noto Sans TC';
font-style: normal;
font-weight: 400;
src: url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.eot'); /* IE9 Compat Modes */
src: url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.svg#NotoSansTC') format('svg'); /* Legacy iOS */
}
/* noto-sans-tc-700 - latin_chinese-traditional */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Noto Sans TC';
font-style: normal;
font-weight: 700;
src: url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.eot'); /* IE9 Compat Modes */
src: url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.svg#NotoSansTC') format('svg'); /* Legacy iOS */
}
/* noto-sans-tc-regular - latin_chinese-traditional */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Noto Sans TC';
font-style: normal;
font-weight: 400;
src: url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.eot'); /* IE9 Compat Modes */
src: url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-regular.svg#NotoSansTC') format('svg'); /* Legacy iOS */
}
/* noto-sans-tc-700 - latin_chinese-traditional */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Noto Sans TC';
font-style: normal;
font-weight: 700;
src: url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.eot'); /* IE9 Compat Modes */
src: url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/noto-sans-tc-v26-latin_chinese-traditional-700.svg#NotoSansTC') format('svg'); /* Legacy iOS */
}
@if list.index($fonts, 'Noto Sans SC') {
/* noto-sans-sc-regular - latin_chinese-simplified */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Noto Sans SC';
font-style: normal;
font-weight: 400;
src: url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.eot'); /* IE9 Compat Modes */
src: url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.svg#NotoSansSC') format('svg'); /* Legacy iOS */
}
/* noto-sans-sc-700 - latin_chinese-simplified */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Noto Sans SC';
font-style: normal;
font-weight: 700;
src: url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.eot'); /* IE9 Compat Modes */
src: url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.svg#NotoSansSC') format('svg'); /* Legacy iOS */
}
/* noto-sans-sc-regular - latin_chinese-simplified */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Noto Sans SC';
font-style: normal;
font-weight: 400;
src: url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.eot'); /* IE9 Compat Modes */
src: url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.woff') format('woff'), /* Modern Browsers */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-regular.svg#NotoSansSC') format('svg'); /* Legacy iOS */
}
/* noto-sans-sc-700 - latin_chinese-simplified */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Noto Sans SC';
font-style: normal;
font-weight: 700;
src: url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.eot'); /* IE9 Compat Modes */
src: url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.woff2') format('woff2'), /* Super Modern Browsers */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.woff') format('woff'), /* Modern Browsers */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/noto-sans-sc-v26-latin_chinese-simplified-700.svg#NotoSansSC') format('svg'); /* Legacy iOS */
}
@if list.index($fonts, 'sitelen-pona-pona') {
@font-face {
font-family: 'sitelen-pona-pona';
font-style: normal;
font-weight: 400;
src: url('/fonts/sitelen-pona-pona.otf') format("opentype")
}
@font-face {
font-family: 'sitelen-pona-pona';
font-style: normal;
font-weight: 400;
src: url('/fonts/sitelen-pona-pona.otf') format("opentype")
}
@if list.index($fonts, 'linjapimejapona') {
@font-face {
font-family: 'linjapimejapona';
font-style: normal;
font-weight: 400;
src: url('/fonts/linjapimejapona.ttf') format("truetype")
}
@font-face {
font-family: 'linjapimejapona';
font-style: normal;
font-weight: 400;
src: url('/fonts/linjapimejapona.ttf') format("truetype")
}
@if list.index($fonts, 'Rubik') {
/* rubik-300 - arabic_latin_latin-ext */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Rubik';
font-style: normal;
font-weight: 400;
src: url('/fonts/rubik-v28-arabic_latin_latin-ext-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* rubik-700 - arabic_latin_latin-ext */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Rubik';
font-style: normal;
font-weight: 700;
src: url('/fonts/rubik-v28-arabic_latin_latin-ext-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* rubik-300 - arabic_latin_latin-ext */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Rubik';
font-style: normal;
font-weight: 400;
src: url('/fonts/rubik-v28-arabic_latin_latin-ext-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* rubik-700 - arabic_latin_latin-ext */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Rubik';
font-style: normal;
font-weight: 700;
src: url('/fonts/rubik-v28-arabic_latin_latin-ext-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* baloo-bhaijaan-2-regular - arabic_latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Baloo Bhaijaan 2';
font-style: normal;
font-weight: 400;
src: url('/fonts/baloo-bhaijaan-2-v19-arabic_latin-regular.woff2') format('woff2'), /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
url('/fonts/baloo-bhaijaan-2-v19-arabic_latin-regular.ttf') format('truetype'); /* Chrome 4+, Firefox 3.5+, IE 9+, Safari 3.1+, iOS 4.2+, Android Browser 2.2+ */
}
/* baloo-bhaijaan-2-700 - arabic_latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Baloo Bhaijaan 2';
font-style: normal;
font-weight: 700;
src: url('/fonts/baloo-bhaijaan-2-v19-arabic_latin-700.woff2') format('woff2'), /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
url('/fonts/baloo-bhaijaan-2-v19-arabic_latin-700.ttf') format('truetype'); /* Chrome 4+, Firefox 3.5+, IE 9+, Safari 3.1+, iOS 4.2+, Android Browser 2.2+ */
}
.shavian {
--font-text: 'Noto Sans Shavian';
font-family: list.join(var(--font-text), $font-fallback);
}
@if list.index($fonts, 'Baloo Bhaijaan 2') {
/* baloo-bhaijaan-2-regular - arabic_latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Baloo Bhaijaan 2';
font-style: normal;
font-weight: 400;
src: url('/fonts/baloo-bhaijaan-2-v19-arabic_latin-regular.woff2') format('woff2'), /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
url('/fonts/baloo-bhaijaan-2-v19-arabic_latin-regular.ttf') format('truetype'); /* Chrome 4+, Firefox 3.5+, IE 9+, Safari 3.1+, iOS 4.2+, Android Browser 2.2+ */
}
/* baloo-bhaijaan-2-700 - arabic_latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Baloo Bhaijaan 2';
font-style: normal;
font-weight: 700;
src: url('/fonts/baloo-bhaijaan-2-v19-arabic_latin-700.woff2') format('woff2'), /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
url('/fonts/baloo-bhaijaan-2-v19-arabic_latin-700.ttf') format('truetype'); /* Chrome 4+, Firefox 3.5+, IE 9+, Safari 3.1+, iOS 4.2+, Android Browser 2.2+ */
.sitelen {
--font-text: 'linjapimejapona';
font-family: list.join(var(--font-text), $font-fallback);
.cartouche {
padding: .1em;
margin-inline-start: .15em;
margin-inline-end: .15em;
border: .075em solid #000;
border-radius: .2em;
font-size: 0.9em;
}
}

View File

@ -1,12 +1,9 @@
@use "sass:list";
@use "sass:math";
@import "../data/variables";
$fontExtra: null !default;
$fonts: list.join(list.join($fontHeadings, $fontText), $fontExtra);
$font-family-sans-serif: list.join($fontText, (sans-serif, "Noto Color Emoji", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol")) !default;
$headings-font-family: list.join($fontHeadings, (sans-serif, $fontText, "Noto Color Emoji", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol")) !default;
$font-fallback: sans-serif, "Noto Color Emoji", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
$font-family-sans-serif: list.join(var(--font-text), $font-fallback);
$headings-font-family: list.join(var(--font-headings), $font-fallback);
$btn-font-family: $font-family-sans-serif;
$font-family-base: $font-family-sans-serif;

View File

@ -7,7 +7,7 @@
<ul class="list-unstyled" style="column-count: 2;">
<li v-for="(options, locale) in otherLocales" :key="locale" class="mb-1">
<a :href="options.url">
<Icon :v="config.dir === 'rtl' ? 'long-arrow-left' : 'long-arrow-right'" />
<Icon :v="config.style.dir === 'rtl' ? 'long-arrow-left' : 'long-arrow-right'" />
<!-- <LocaleIcon :locale="options" class="me-1"/> -->
{{ options.name }}
<small v-if="options.extra" class="text-muted">({{ options.extra }})</small>

View File

@ -1,5 +1,9 @@
locale: '_'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: false
disableTranslationProposals: true

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: '<TODO>'
# dir: 'rtl'
style:
# dir: 'rtl'
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'ar'
dir: 'rtl'
style:
dir: 'rtl'
fontHeadings: ['Baloo Bhaijaan 2']
fontText: ['Baloo Bhaijaan 2']
header: true

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Baloo Bhaijaan 2';
$fontText: 'Baloo Bhaijaan 2';

View File

@ -14,12 +14,8 @@ export interface Config {
* @default locale
*/
intlLocale?: string;
style: StyleConfig;
format?: FormatConfig;
/**
* text direction
* @default "ltr"
*/
dir?: 'ltr' | 'rtl';
/**
* age limit for users
* @default 13
@ -133,6 +129,22 @@ interface FormatConfig {
timezone: string;
}
interface StyleConfig {
/**
* text direction
* @default "ltr"
*/
dir?: 'ltr' | 'rtl';
/**
* fonts used in headings, sorted by priority
*/
fontHeadings: string[];
/**
* fonts used in texts, sorted by priority
*/
fontText: string[];
}
export interface PronounsConfig {
/**
* route path for the pronouns list page (translated)

View File

@ -1,5 +1,9 @@
locale: 'de'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'en'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
disableTranslationProposals: true

View File

@ -1,7 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';
$fontExtra: 'Noto Sans Shavian';
.shavian {
font-family: $fontExtra, $fontText;
}

View File

@ -1,5 +1,9 @@
locale: 'eo'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'es'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'et'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,6 +1,10 @@
locale: 'fo'
# dir: 'rtl'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'fr'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'gl'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'hbs'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,10 @@
locale: 'he'
dir: 'rtl'
style:
dir: 'rtl'
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'it'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
format:
timezone: 'Europe/Rome'

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'ja'
style:
fontHeadings: ['Zen Maru Gothic']
fontText: ['Zen Maru Gothic']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Zen Maru Gothic';
$fontText: 'Zen Maru Gothic';

View File

@ -1,5 +1,9 @@
locale: 'ko'
style:
fontHeadings: ['Nanum Gothic']
fontText: ['Nanum Gothic']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Nanum Gothic';
$fontText: 'Nanum Gothic';

View File

@ -1,5 +1,9 @@
locale: 'lad'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'nb'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'nl'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'nn'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'no'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
macrolanguage:
enabled: true
languages:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'pl'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
format:
timezone: 'Europe/Warsaw'

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'pt'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'ro'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'ru'
style:
fontHeadings: ['Nunito']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Nunito';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'sv'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'tok'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,15 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';
$fontExtra: 'linjapimejapona';
.sitelen {
font-family: $fontExtra, $fontText;
.cartouche {
padding: .1em;
margin-inline-start: .15em;
margin-inline-end: .15em;
border: .075em solid #000;
border-radius: .2em;
font-size: 0.9em;
}
}

View File

@ -1,5 +1,9 @@
locale: 'tr'
style:
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,6 +1,10 @@
locale: 'ua'
intlLocale: 'uk-UA'
style:
fontHeadings: ['Nunito']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Nunito';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'vi'
style:
fontHeadings: ['Nunito']
fontText: ['Nunito']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Nunito';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'yi'
dir: 'rtl'
style:
dir: 'rtl'
fontHeadings: ['Quicksand']
fontText: ['Nunito']
header: true

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand';
$fontText: 'Nunito';

View File

@ -1,5 +1,9 @@
locale: 'zh'
style:
fontHeadings: ['Quicksand', 'Noto Sans TC', 'Noto Sans SC']
fontText: ['Nunito', 'Noto Sans TC', 'Noto Sans SC']
header: true
pronouns:

View File

@ -1,2 +0,0 @@
$fontHeadings: 'Quicksand', 'Noto Sans TC', 'Noto Sans SC';
$fontText: 'Nunito', 'Noto Sans TC', 'Noto Sans SC';

View File

@ -61,7 +61,7 @@ const postCssPlugins: Record<string, object> = {
cssnano: {},
};
if (config.dir === 'rtl') {
if (config.style.dir === 'rtl') {
postCssPlugins.rtlcss = {};
}

View File

@ -52,7 +52,7 @@ const imageSize = 200;
const leftRatio = 4;
const getBannerKey = defineCachedFunction(async (path: string, db: Database) => {
const fontName = registerLocaleFont('fontHeadings', ['regular', 'bold']);
const fontName = registerLocaleFont(global.config, 'fontHeadings', ['regular', 'bold']);
const canvas = createCanvas(width, height);
const context = canvas.getContext('2d');

View File

@ -245,7 +245,7 @@ router.get('/nouns/:id.png', async (req, res) => {
const height = padding * 2.5 + (maxItems + 1) * 48 + padding;
const mime = 'image/png';
const fontName = registerLocaleFont('fontHeadings', ['regular', 'bold']);
const fontName = registerLocaleFont(global.config, 'fontHeadings', ['regular', 'bold']);
registerFont('node_modules/@fortawesome/fontawesome-pro/webfonts/fa-light-300.ttf', { family: 'FontAwesome', weight: 'regular' });
const canvas = createCanvas(width, height);

View File

@ -1,15 +1,6 @@
import fs from 'fs';
import { registerFont } from 'canvas';
import { rootDir } from './paths.ts';
const vars: Record<string, string> = {};
for (const [, name, value] of fs.readFileSync(`${rootDir}/data/variables.scss`).toString('utf-8')
.matchAll(/^\$([^:]+): '([^']+)'(?:, '[^']+')*;$/gm)) {
vars[name] = value;
}
import type { Config } from '~/locale/config.ts';
const fontSources: Record<string, string> = {
'Baloo Bhaijaan 2': 'baloo-bhaijaan-2-v19-arabic_latin-{weight}.ttf',
@ -23,8 +14,12 @@ const weightsValues: Record<string, string> = {
bold: '700',
};
export const registerLocaleFont = (v: string, weights: string[] = ['regular']): string => {
const family = vars[v];
export const registerLocaleFont = (
config: Config,
variable: 'fontHeadings' | 'fontText',
weights: string[] = ['regular'],
): string => {
const family = config.style[variable][0];
const source = fontSources[family];
for (const weight of weights) {
registerFont(`public/fonts/${source.replace('{weight}', weightsValues[weight] || weight)}`, { family, weight });

View File

@ -2,6 +2,10 @@ import type { ConfigWithEnabled } from '~/locale/config.ts';
export const configWithPronouns: ConfigWithEnabled<'pronouns'> = {
locale: 'en',
style: {
fontHeadings: ['Quicksand'],
fontText: ['Nunito'],
},
header: true,
pronouns: {
enabled: true,