-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Include individual text values for each font #149
base: main
Are you sure you want to change the base?
Conversation
I just realized that this could also be implemented in google-fonts-helper. Not sure which way would be better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jakubkoje
Thanks for the PR, I made some observations
You also need to add tests 😄
} | ||
}) | ||
|
||
logger.start('Downloading fonts...') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add outside for
|
||
logger.start('Downloading fonts...') | ||
await downloader.execute() | ||
logger.success('Download fonts completed.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add outside for
// Disable sanitazions | ||
// @ts-ignore | ||
head.__dangerouslyDisableSanitizersByTagID = head.__dangerouslyDisableSanitizersByTagID || {} | ||
// @ts-ignore | ||
head.__dangerouslyDisableSanitizersByTagID['gf-script'] = ['innerHTML'] | ||
// @ts-ignore | ||
head.__dangerouslyDisableSanitizersByTagID['gf-noscript'] = ['innerHTML'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add outside for
for (const url of urls) { | ||
head.script.push({ | ||
key: 'gf-script', | ||
innerHTML: `(function(){var l=document.createElement('link');l.rel="stylesheet";l.href="${url}";document.querySelector("head").appendChild(l);})();` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe create a script to create the stylesheet.
In case of several url this script will be duplicated.
children: `(function(){ | ||
var h=document.querySelector("head"); | ||
var m=h.querySelector('meta[name="head:count"]'); | ||
if(m){m.setAttribute('content',Number(m.getAttribute('content'))+1);} | ||
else{m=document.createElement('meta');m.setAttribute('name','head:count');m.setAttribute('content','1');h.append(m);} | ||
var l=document.createElement('link');l.rel='stylesheet';l.href='${url}';h.appendChild(l); | ||
})();` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe create a script to create the stylesheet.
In case of several url this script will be duplicated.
so is it possible rn? |
Not yet. I don't have much time right now to continue with this pull request, help would be appreciated. |
Current Situation:
Currently, as reported in #106, it is not possible to include only the requested text for each individual font. The current implementation fetches the entire font data in one call, and there is no way to specify separate text values for each font using the Google API.
Proposed Solution:
To enable this feature, we need to modify the font fetching process and split it into separate calls. By doing so, we can include only the requested text for each font. This adjustment will ensure that the Google API can handle separate text values for individual fonts.
I would love to someone who is more experienced with Nuxt modules to check if the downloading still works as expected.