Hacker News new | ask | show | jobs
by pyre 4320 days ago
Local dev on a javascript-heavy app is one use. You run your build tools to generate the static files (e.g. a Grunt build process with grunt-contrib-watch configured), and then you need a local web server to serve up the files. I tend to stick with:

  python -m SimpleHTTPServer
though.

I actually setup a Tmuxinator session for such projects. It launches the static file server, the continuous build process, and a shell in the source directory.

Why not just run static files from disk? Most browsers refuse to execute JavaScript from file:/// Urls for security reasons (understandably).

1 comments

I've done all of my client sidy test/prototyping javascript with plain .html and .js files.

<script src="app.js"></script> Should work in all browsers, at least on windows. It just looks for app.js relative to the root html file.

I currently work with two apps that interact. One might generate a URL to the other. The base url is defined in a config file. I find it easier to just define 'localhost:PORT' for each app.