varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.46k stars 65 forks source link

Export option similar to ./gradlew jsBrowserProductionWebpack #206

Closed franz-sw closed 1 year ago

franz-sw commented 1 year ago

It would be helpful to have a simplified export option similar to ./gradlew jsBrowserProductionWebpack. So you can simply copy and paste the output to the server.

bitspittle commented 1 year ago

Hi! Thanks for trying Kobweb!

Can you help me understand your use case more clearly?

franz-sw commented 1 year ago

I don't use a hoisting service I just have some webspace (from my email domain) that I can access with FTP. The server then calls the index.html file as the entry point. If I use compose for web and run ./gradlew jsBrowserProductionWebpack I get all the files ready in a folder where I can then use the index.html file to open the site offline or just copy everything to the server.

Sorry if I miss something, but I'm really new to web development.

David Herman @.***> schrieb am Do., 26. Jan. 2023, 21:50:

Hi! Thanks for trying Kobweb!

Can you help me understand your use case more clearly?

— Reply to this email directly, view it on GitHub https://github.com/varabyte/kobweb/issues/206#issuecomment-1405633421, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5PNKTH73YYJBNL76VEFUELWULPSHANCNFSM6AAAAAAUHVPEPQ . You are receiving this because you authored the thread.Message ID: @.***>

bitspittle commented 1 year ago

Don't worry, I was pretty new to web development when I started this project.

Check out https://bitspittle.dev/blog/2022/staticdeploy which talks about static layouts. Maybe that will work for what you're trying to do?

franz-sw commented 1 year ago

Unfortunately it doesn't give me the desired result when I export kobweb with layout static. When I run the index.html I only get a web page without function/navigation and the web.js is not found either.

The desired result (as with compose for web) would be that I have a fully functional web page when I run the index.html file.

bitspittle commented 1 year ago

I'm still not sure what your hosting situation is. Are you trying to download the index.html file locally and open it from disk?

franz-sw commented 1 year ago

No i try to open/execute the index.html inside .kobweb/site. (just for testing, but it is the same situation like on the server)

Using compose for web it is working fine.

bitspittle commented 1 year ago

So when I tried to do what you were doing, I got a site that opened up correctly but wouldn't let me navigate to another page. Are you seeing that? Or something else?

The JS file that gets created by kobweb export is actually generated by jsBrowserProductionWebpack.

bitspittle commented 1 year ago

Here is a video capture of me exporting my blog site (https://bitspittle.dev) (For your convenience, I skipped over about a minute of exporting)

Let's double check if you're seeing the same behavior.

https://user-images.githubusercontent.com/43705986/215138189-97a3ef89-a267-444e-b961-b6ad38661172.mp4

Note that, while this works, the second I try to navigate, it will break. This is because Kobweb navigation logic assumes you are rooted at "/" (e.g. "https://yoursite.com/" or "file://") So in my site, if I click on the "blog" link, instead of it going from file:///home/blah/path/whatever/index.html to file:///home/blah/path/whatever/blog/, it will incorrectly go to file:///blog, since it has no idea where the site root is.

franz-sw commented 1 year ago

Ok I understand. What would you suggest in my Case?

bitspittle commented 1 year ago

To be honest I'm still not sure 1) exactly what you're doing on your side, 2) what you're seeing, and 3) what you want to happen.

One thing that might help: Feel free to assume I'm dumb, and give me very clear and detailed steps of what you're doing on your end.

Finally, it's possible that Kobweb is designed to solve a different problem than the one you have. If Compose for Web is working for you, what were you hoping to get from Kobweb?

franz-sw commented 1 year ago

I will leave it at that because I have more or less achieved what I wanted. I created a web preview / advertisement for my app using kobweb. Since I didn't necessarily need javascript, it was sufficient to just use the HTML file I created. So thanks for not making me learn HTML because of kobweb.

bitspittle commented 1 year ago

Hahaha you're welcome.

Drop by the Discord if you ever have any further questions.

bitspittle commented 1 year ago

(Closing as can not reproduce, apologies for never quite figuring out what was wrong in your case. Feel free to comment again later to reopen if you'd like)