asny / three-d

2D/3D renderer - makes it simple to draw stuff across platforms (including web)
MIT License
1.29k stars 109 forks source link

Full Webpack example including local server #375

Closed x3ro closed 1 year ago

x3ro commented 1 year ago

Hey @asny! Thanks for building this crate, it's been a pleasure to use so far :)

I'm using it for WASM thingsβ„’, and in the beginning it wasn't completely obvious to me how to get the examples running the browser. I saw in #277 that this may be made easier by tooling in the future. In the meantime, I was wondering whether you'd want to add something like what I'm proposing here, to help people get started with your crate and WASM.

Usage

  1. Run npm install in the web/ directory
  2. Run ./build_and_serve.sh (optionally with the name of the example you want to build)
  3. Open http://localhost:8080, where you should see the example

TODO

I haven't polised this yet, since I wasn't sure whether or not this would be accepted.

asny commented 1 year ago

Hi @x3ro .

Thank you for your kind words πŸ™ And thanks for the suggestion, I think it's a great idea! Anything that makes it easier to get started is worth the effort IMO πŸ‘

The only thing I think is missing is updating the README. Maybe add a new README in the web folder which describes how to build for web? Basically what is in this README at the moment, so move and update that. Maybe a link from the main README would be good as well?

About the bash script, I would actually rather avoid it than expand on it. Could it be replaced by a step-by-step guide in the README instead? My worry is that I have to maintain the script, so a guide is less work for me.

x3ro commented 1 year ago

About the bash script, I would actually rather avoid it than expand on it. Could it be replaced by a step-by-step guide in the README instead? My worry is that I have to maintain the script, so a guide is less work for me.

Makes sense. I like the bash script approach because it eliminates some easy errors, such as "I'm executing the commands from the wrong directory", but I get that maintaining bash scripts isn't fun πŸ˜… I'll incorporate the steps in the README πŸ‘πŸΌ

So, to summarize, I will

Does that sounds good?

asny commented 1 year ago

It sounds perfect, thank you πŸ™

And just for the record, if this was work related code, I would prefer a bash script as well. I just really don't want to maintain bash scripts in my free time πŸ˜„

x3ro commented 1 year ago

Okay, finally have gotten around to updating this πŸ˜… There is a README now that explains the steps. One thing I noticed is that mouse interaction isn't working for some reason πŸ€” I'll investigate, but perhaps you have an idea why that is

asny commented 1 year ago

Nice! Thanks for the contribution πŸ’ͺ