Skip to content
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

Add public API #20

Merged
merged 5 commits into from
Feb 21, 2024
Merged

Add public API #20

merged 5 commits into from
Feb 21, 2024

Conversation

stryaponoff
Copy link
Contributor

I was needed to add generated fonts to the <link rel="preload" />. Firstly, I was thinking about add this functionality to your plugin but then I decided that the public API is a better option and implemented it along with a custom plugin for my needs that rely on your plugin.

@@ -54,6 +57,11 @@ export function viteSvgToWebfont<T extends GeneratedFontTypes = GeneratedFontTyp
return {
name: 'vite-svg-2-webfont',
enforce: 'pre',
api: {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I was unable to find any docs about this, could you share some docs about how this works and where it can be used?
Also, care to document this in the README?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Here's the docs: https://rollupjs.org/plugin-development/#direct-plugin-communication

I'll update the readme a little bit later.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reference!
I'd be happy to merge once there is some readme about this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I'll plan to update the readme tomorrow. Sorry for the delay :(

- **description**
- `type` - a font format generated by a plugin
- `href` - a path to a generated font
- [This repo](https://github.com/stryaponoff/vite-plugin-preload-webfont) contains the usage example.
Copy link
Contributor Author

@stryaponoff stryaponoff Feb 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to find a best way to provide an example of how it works without adding a big code examples to the README.md and without duplicating your ./example dir so I just made another repo with plugin example.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works IMHO 🙂

README.md Outdated Show resolved Hide resolved
- **description**
- `type` - a font format generated by a plugin
- `href` - a path to a generated font
- [This repo](https://github.com/stryaponoff/vite-plugin-preload-webfont) contains the usage example.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works IMHO 🙂

Co-authored-by: Chemi Atlow <[email protected]>
@atlowChemi atlowChemi merged commit cda388b into atlowChemi:main Feb 21, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants