-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
How do I use UI components? #279
Comments
Hey @timmyjan46, thanks for your interest in Bud! I'm surprised that bud/framework/view/view_test.go Line 361 in 2b3cf75
Importing non-JS/TS/Svelte assets doesn't work yet and I'm not sure if that's something worth adding. What do you expect |
Thanks for answering so quickly! I was expecting I can try and work out how to add a test but I'm not sure if I'll succeed but I'll give it a go. |
Oh got it, I'll have a look at how vite does it. I'm on the fence about importing assets via JS because sometimes I could see people expecting a data-uri. I do see the convenience in this and maybe I can make it pluggable.
Commented on your PR, you did everything as expected, thanks! |
I say you updated the PR but the test only makes sure that you can import from the root of the views folder. I'm still having trouble using components in any other directory. For example, if I have the file view/stories/index.svelte and try to import a component from ui/Time.svelte, import Time from "../ui/Time.svelte" obviously doesn't work here. Is there a way I can access the root of the project from anywhere? or as SvelteKit does it: allow you to import from $lib anywhere. Thanks for your time and sorry for making so much trouble. |
It's all relative paths so in that case you'd do
Not yet! That's what I'd like to add with the |
Hello, I am very interested in this project but I can't work out where I am going wrong here.
I don't understand how to import ui components from svelte files.
I have a folder in the base of the project named "ui" and a file named "Test.svelte" in it.
If I try to import the component in the main index.svelte of the page like this:
import Test from "ui/Test.svelte"
I get this error:
You can mark the path "ui/Test.svelte" as external to exclude it from the bundle, which will remove this error.
I also get the same error when I try and import an asset from the public directory like so:
import image from "public/image.png"
The text was updated successfully, but these errors were encountered: