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

Use named imports in docs #155

Open
theetrain opened this issue Dec 16, 2022 · 3 comments
Open

Use named imports in docs #155

theetrain opened this issue Dec 16, 2022 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@theetrain
Copy link
Collaborator

Current example:

<script>
  import Accessibility from "carbon-icons-svelte/lib/Accessibility.svelte";
</script>

<Accessibility />

Proposed example:

<script>
  import { Accessibility } from "carbon-icons-svelte";
</script>

<Accessibility />

Since a lot of the time Icons can be autocompleted, using named imports is something users may expect.

image

@theetrain theetrain added the documentation Improvements or additions to documentation label Dec 16, 2022
@metonym
Copy link
Collaborator

metonym commented Jan 19, 2023

I agree that it would be more concise/correct to import from the root; however, I'm worried that users may run into #132 (without using the imports preprocessor or if using a non-Vite set-up).

This might be addressed if the architecture of this library is completely revamped #156

@theetrain
Copy link
Collaborator Author

Agreed, #156 should resolve this. The main issue is with projects using a mix between named imports and deep imports may cause performance issues in dev mode. With the new icon set being thousands of icons, I believe having a single Icon.svelte should help with performance.

I haven't tested this, but in the current state (with [email protected]) it's probably most performant to use carbon-icons-svelte with deep imports, and without the optimizeImports preprocessor.

@metonym
Copy link
Collaborator

metonym commented Jan 19, 2023

Actually, even in the interim, I'm fine with using named imports in the docs site because that's the happy path. The README should also be updated, which doesn't even mention the preprocessor/Vite set-up.

@metonym metonym self-assigned this Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants