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

docs: replace svg icons with css icons #20266

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

userquin
Copy link
Member

@userquin userquin commented Aug 1, 2024

Description

This PR will replace @mdi/js in the docs, but will still use the library and @mdi/svg for the mdi autocomplete in font-icons page.

There are a lot of svg icons on every page, using css icons will remove all svg icons from every page and vue component: since we're using same icons on every page (navbar, menu, code), UnoCSS will include only used icons once (svg solution will include the same icon multiple times in the dom if included multiple times).

Additionally, with css icons we can include any other iconify json library adding the corresponding @iconify-json/<collection> dev dependency and using it with vuetify components or directly with html markup :

<v-icon icon="i-logos:discord"></v-icon>
<div class="i-logos:discord"></div>

✔️ We need to review export examples logic, maybe we should change the icons back to mdi-*.

FIXED: Right now the docs cannot be built on my local, I'm checking what's happening (vue error without the source):

Error

image

Markup:

NA

@userquin
Copy link
Member Author

userquin commented Aug 2, 2024

The entry point still huge 7.9MB, we'll need my other PR merged here #20260. The resulting css is about 809KB, the original 599KB.

@johnleider
Copy link
Member

The only issue I see is that icon's won't work when you open an example in the Vuetify Playground.

@userquin
Copy link
Member Author

userquin commented Aug 2, 2024

Using UnoCSS we can install VSCode or JetBrains extensions for icon preview and suggestions/autocomplete, for example, adding these 2 extensions to VSCode:

imagen

There is also UnoCSS extension for JetBrains IDE, for example, on IntelliJ Ultimate Edition (suggestions/autocomplete not working, I'm going to file an issue):

imagen

@userquin userquin changed the title docs: replace mdi js icons with css icons docs: replace svg icons with css icons Aug 2, 2024
@KaelWD
Copy link
Member

KaelWD commented Aug 4, 2024

The resulting css is about 809KB, the original 599KB.

So it replaces 100K of js strings with 200k of CSS?

@userquin
Copy link
Member Author

userquin commented Aug 4, 2024

Yes and no, it is adding only used icons, the optimal solution should be to include only in css navbar and playgroubd icons. The mdijs svg lib is huge.

Maybe this PR is not optimal with vuetify docs as a spa client app.

I Will check it using vue-scoped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants