mdn / webaudio-examples

Code examples that accompany the MDN Web Docs pages relating to Web Audio.
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API
Creative Commons Zero v1.0 Universal
1.28k stars 433 forks source link

Added npm tooling to serve files with livereload #51

Closed fijiwebdesign closed 1 year ago

fijiwebdesign commented 3 years ago

Added tooling to start a http server with live-reload built in

npm install
npm start
Leokuma commented 3 years ago

This repo has educational purposes. As far as I understand, you are suggesting the student to install npm, add 4 dependencies (one of them being Express) and run a local server only so that the student doesn't have to hit F5. IMO that doesn't help learning. It might even make things unnecessarily confusing for the beginner.

fijiwebdesign commented 3 years ago

This repo has educational purposes. As far as I understand, you are suggesting the student to install npm, add 4 dependencies (one of them being Express) and run a local server only so that the student doesn't have to hit F5. IMO that doesn't help learning. It might even make things unnecessarily confusing for the beginner.

The tooling is purely optional of course. It does provide an easy way to serve the examples and help the developers that extend the codebase.

clemens-tolboom commented 2 years ago

I myself use VSCode with the Live Server v5.7.9 from Ritwick Dey. WebStorm has similar feature. Even python3 -m http.server could do the jobs (apart for WebASM iirc)

So I don't need this option to have out of the box config available for a server.

bsmth commented 2 years ago

I agree with the others in here about leaving the tooling out of this repo, but what we can offer is some documentation that shows how to serve directory contents in a generic way.

Can we improve the README with build instructions, maybe? I'm personally using http-server so it looks like

npm install -g http-server
cd example-dir
http-server

The python example above is also great. What do you think?

hamishwillee commented 2 years ago

What @bsmth said - though I would link to https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server#running_a_simple_local_http_server

teoli2003 commented 2 years ago

There is also an extension to VSCode (vscode-preview-server) that allows launching a local website in one click. (It is based on the free and open browsersync.io tool).

hamishwillee commented 2 years ago

@teoli2003 That's cool - I wonder if it is worth adding to https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server#running_a_simple_local_http_server as well?

Rumyra commented 2 years ago

Almost a discussion... but pinging @schalkneethling - do you think it's worth adding a note to the 'demo' repos readmes (once we've rolled out the template files) with a couple of options to serve locally?

bsmth commented 1 year ago

Hi @fijiwebdesign thanks a lot for suggesting the changes - I think there's a preference to give some documentation hints instead of adding tooling, so I'm closing this in favor of https://github.com/mdn/webaudio-examples/pull/110

If you have some feedback or suggestions, please feel free to leave it on the other pull request. Thank you :)