Hacker News new | ask | show | jobs
by newhouseb 5349 days ago
Sigh, these sorts of things always force you to change how you develop and don't really work for mobile web dev. This wheel seems to been re-invented far too often.

Alternatively:

  sudo pip install watchdog
  watchmedo shell-command -w -c "make" -i '*/.*' -R
Where "make" is either for a makefile or some other build script.

And then just put live.js (from http://livejs.com/) as a script inside your pages.

This works anywhere with basically any stack (i.e. if you had some strange alien CSS preprocessor as long as it can be processed with a command you can use this), integrates into your normal build system and requires no browser plugins or proprietary binaries.

2 comments

LiveReload should works on every browser that supports WebSockets. It should work on modern WebKit-based mobile browsers.

Live.js uses polling. It sends XHR HEAD request every second.

LiveReload monitors file changes using FSEvents (on Mac OS X) and inotify (on Linux). When the file modified, it pushes its path to the browser and reloads immediately.

> Live.js uses polling. It sends XHR HEAD request every second.

The horror!

It is horror when you forget about it, and push it up to production
Has nothing to do with Live.js then. Isn't really even about a developer's forgetfulness when pushing to production. It would be about failure to set up different production and development environments, which can cause problems much worse than a wasteful AJAX call.
Unfortunately it also spins up your fans and eats up your battery. (Also I've built the GUI tool when I got tired of firing up stuff in Terminal each time I start working on a project.)
This depends on what platform you're on - if you're on Linux, it will use inotify which is event based from the kernel (and therefore pretty efficient) and I think they recently added the OSX equivalent.