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(web-fonts): add local font support to web font preset #3710
Conversation
β Deploy Preview for unocss failed.Built without sensitive environment variables
|
} | ||
|
||
// FIXME Currently hardcoded to the playground folder | ||
const fontsFolder = resolve(dir, '../../../playground/assets/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.
I need to write the new fonts into the assets folder but I am not sure how to get that relative path from the 'virtual:uno.css'
Any ideas?
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.
When this PR is done I will revert this changes. Just for testing!
I have no idea how to get the path from the root project in order to write the fonts to the assets folder. I don't even know if this is the right solution... Or should I use a virtual Vite file instead? I am blocked now π Any ideas are much welcomed! Thanks! |
I guess you will need to add an option to the preset (where to download the fonts?, by default I don't see any protection when running in the browser, you should protect the preset: check preset-icons EDIT: check also SVG sprites PR, you can move the logic to the plugin since we don't have that feature in the browser. About using the CLI, you can expose some helper function (in the preset) with the logic, this way, Vite, WebPack, any meta framework and the CLI can use it. |
I'll try to add initial logic for vite (with small preset changes), later we can add webpack and CLI support (CLI will not require any integration since it is not a bundler, we only need the download logic): we need to add support for dev server to download the fonts |
@onmax shouldn't the css also be saved locally? |
Yes. You are right. I have to download the CSS locally. This is what the
|
#3723 3723 |
ποΈ WIP
Solves #3646