Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Register ui components globally #584

Open
1 of 4 tasks
PawFV opened this issue Feb 11, 2021 · 2 comments
Open
1 of 4 tasks

Register ui components globally #584

PawFV opened this issue Feb 11, 2021 · 2 comments
Labels
feature request New feature or request

Comments

@PawFV
Copy link

PawFV commented Feb 11, 2021

What is the motivation for adding/enhancing this feature?

Vue ui components are getting imported manually in each component, since they are spreadly used they should be registered globally to avoid having to import and registering them in each component.

Examples:

Manual imports inside a component:
image

Registered globally.
image

16 lines of code avoided. just in one file...

What are the acceptance criteria?

Vue docs about global registration.

  • Be able to use SF UI components in any component without having to import them
  • Be able to use SF UI components in any component without having to add them to components array

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

@dt2patel
Copy link
Collaborator

What is the performance impact of doing this?

@PawFV
Copy link
Author

PawFV commented Apr 12, 2021

What is the performance impact of doing this?

From my point of view, not much, you prioritize development speed, clean code structure and scalability over 100kb extra in your bundle size. I'm just using what I listed above and if any it eased a bit the chaos when developing, I'm more concerned about the performance of other setups if that makes sense. If you want a clean approach which it's documented in Vuejs docs

docs

It's essentially describing the issue I see here, where you have too many repetitions. First thing that clicks into my mind when I start to see repeated patterns, "If I'm doing that much repetition then I'm doing something wrong".

You can actually use a fancier solution which is registering them on-demand, it's linked in the docs I sent you, here is the example.

Another issue I see with the way this whole ecosystem is that isn't published as an npm packages, so it would be miles easier to let the user decide which component/mixin/functionality they want to use and just link the docs for its usage.

Another example you can look is, a well known UI library, Vuetify. Take a look at how it's built.

Here is an example, I built a vuejs app with default webpack config without vuetify, and then with Vuetify install option. (Which just comes with automatic registration of components, you don't have to import them).

Plain vue
webpack-plain

Vuetify installed
webpack-vuetify

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants