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

feat(Icon)!: migrate from @egoist/tailwindcss-icons to new @nuxt/icon #1789

Merged
merged 10 commits into from
Jun 24, 2024

Conversation

benjamincanac
Copy link
Member

@benjamincanac benjamincanac commented May 14, 2024

πŸ”— Linked issue

Resolves #1188
Resolves #1043
Resolves #1045
Resolves #1182
Resolves #1687
Resolves #1886
Resolves https://github.com/nuxt/ui-pro/issues/143

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR removes the @egoist/tailwindcss-icons dependency in favor of the next major version of nuxt-icon which is now officially @nuxt/icon.

Thanks to the incredible work of @antfu who did a complete rewrite of the module, it now works much better with SSR (no flicking on the client side) so we no longer need to rely on Tailwind CSS to bundle icons. You can check nuxt/icon#154 for the full list of changes.

This PR introduces some breaking changes, but is a big step towards v3:

  1. the ui.icons module option (nuxt.config.ts) is removed

You no longer need to specify which Iconify collection you want to use as @nuxt/icon discovers them automatically. You can remove it safely if you used it with an array of collection or with all. Nuxt Icon will also automatically warn you if you didn't install a @iconify-json collection.

If you used it as an object to provide custom collections, you can now use the icon key in your nuxt.config.ts: https://github.com/nuxt/icon?tab=readme-ov-file#custom-local-collections

  1. the dynamic prop (UIcon.vue) and the ui.icons.dynamic option (app.config.ts) are removed

The dynamic prop was introduced in https://github.com/nuxt/ui/releases/tag/v2.11.0 to use nuxt-icon instead of the default behaviour with @egoist/tailwindcss-icons. It was useful when using dynamic class names or for icons coming from a database for example.

You no longer need this as @nuxt/icon will automatically fallback to Iconify API when the requested icon is not bundled.

  1. nuxtIcon option has been renamed to icon (app.config.ts)

When using the dynamic mode (nuxt-icon), you might have used the nuxtIcon key in your app.config.ts. In Nuxt Icon v1, this has been renamed to icon: https://github.com/nuxt/icon?tab=readme-ov-file#configuration-%EF%B8%8F

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@benjamincanac benjamincanac requested a review from antfu May 14, 2024 13:31
@benjamincanac
Copy link
Member Author

@antfu Should I release @nuxt/ui with [email protected] or wait for the official release?

@benjamincanac
Copy link
Member Author

@antfu Should I remove the use of @egoist/tailwindcss-icons entirely?

@antfu
Copy link
Member

antfu commented Jun 18, 2024

@benjamincanac Sorry I was at conferences yesterday. Is the current state of nuxt-icon covers well the use cases of @nuxt/ui? If so, I think I will go ahead and prepare the v1.0 release.

Do you have the use cases of @egoist/tailwindcss-icons without using the component? Like <div class="i-carbon-apps"/> instead of <Icon icon="i-carbon-apps">? If you always expect users to use the component I think yes you might disable @egoist/tailwindcss-icons - otherwise it might be safe to keep them both for sure

Copy link
Member Author

I guess it does, I haven't encountered any issue. I guess I'll remove @egoist/tailwindcss-icons then, all components use the UIcon component underneath so it should be safe.

@benjamincanac benjamincanac changed the title feat(Icon)!: update to nuxt-icon v1 feat(Icon)!: migrate from @egoist/tailwindcss-icons to nuxt-icon v1 Jun 18, 2024
@benjamincanac benjamincanac marked this pull request as ready for review June 18, 2024 10:51
@benjamincanac benjamincanac changed the title feat(Icon)!: migrate from @egoist/tailwindcss-icons to nuxt-icon v1 feat(Icon)!: migrate from @egoist/tailwindcss-icons to @nuxt/icon Jun 18, 2024
@benjamincanac benjamincanac changed the title feat(Icon)!: migrate from @egoist/tailwindcss-icons to @nuxt/icon feat(Icon)!: migrate from @egoist/tailwindcss-icons to new @nuxt/icon Jun 24, 2024
@benjamincanac benjamincanac merged commit c904604 into dev Jun 24, 2024
2 checks passed
@benjamincanac benjamincanac deleted the feat/nuxt-icon-beta branch June 24, 2024 10:46
@Neo-Zhixing
Copy link

I'm glad that we've finally made the switch. Will certainly make life easier.

@spencerjsmall
Copy link

Been playing around with this on edge and has been such a lifesaver... thank you for implementing! @benjamincanac do you plan on releasing this with v3 or with the next Nuxt UI release?

Copy link
Member Author

@spencerjsmall I'll make a minor release tomorrow as 2.18.0 😊 It is already implemented in v3: https://github.com/benjamincanac/ui3/blob/dev/src/module.ts#L68

binhtranhuu pushed a commit to binhtranhuu/nuxt-ui that referenced this pull request Jul 28, 2024
@zigomir
Copy link

zigomir commented Jul 29, 2024

One problem we're hitting with this migration is that Custom Local Collections can't be used with ssr: false for typical SPA production environment, because it assumes there's a running server serving these custom icons. Previously <=v2.17.x we could deploy all the static assets (.output/public/ dir) into an S3 bucket and call it a day.

What would be your suggested workaround / path forward for this (except staying on v2.17)?

@antfu
Copy link
Member

antfu commented Jul 29, 2024

@zigomir nuxt/icon#223 should improve it, I will release it soon later today

@zigomir
Copy link

zigomir commented Jul 29, 2024

@zigomir nuxt/icon#223 should improve it, I will release it soon later today

awesome, this works, thank you!

@luacooli
Copy link

luacooli commented Oct 7, 2024

Icons Not Rendering in Tool Panel After Update

After updating, the icons inside the tool panel of the AG Grid framework are no longer rendering as expected. Additionally, the following warning appears in the console:

: setup function returned a promise, but no boundary was found in the parent component tree. A component with async setup() must be nested in a in order to be rendered.

@sandros94
Copy link
Collaborator

Icons Not Rendering in Tool Panel After Update

After updating, the icons inside the tool panel of the AG Grid framework are no longer rendering as expected. Additionally, the following warning appears in the console:

: setup function returned a promise, but no boundary was found in the parent component tree. A component with async setup() must be nested in a in order to be rendered.

Hi @luacooli, could I ask you to open up a new issue for this?
https://github.com/nuxt/ui/issues/new?template=bug-report.yml

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