1. more robust way to use live reload in Ubuntu (requires a browser plugin)
  2. NB UPDATE 2015-11-05:This method is now obsolete. I am now simply using webpack's development server.

    NB: this is an improved way over the original way.


    First, you need to install Python LiveReload with:
    pip install livereload

    Following successful installation, do not use the livereload utility for starting a server in a directory (that relies on the old method of using a Guardfile), but rather write your own python script and execute it. E.g. the one I have used (placed in the directory of my sources) is:
    cat livereload-server.py
    #!/usr/bin/env python
    from livereload import Server
    server = Server()
    server.watch('*.html', delay=1)
    server.serve(liveport=35729, host='localhost')
    #this script is apparently automatically serving at 5500
    #I am not sure then, what the below line is doing:
    #server.serve(port=1717, host='localhost')
    I then simply run it with:
    Typical output is:
    [I 150917 18:09:17 server:271] Serving on http://localhost:5500
    [I 150917 18:09:17 handlers:58] Start watching changes
    [I 150917 18:09:17 handlers:60] Start detecting changes
    [I 150917 18:09:18 handlers:131] Browser Connected: http://localhost:5500/foo.html
    [I 150917 18:09:18 handlers:78] Ignore: foo.html
    Notice that a message to the effect that the browser was connected is displayed. This obviously requires installing the LiveReload plugin extension (e.g. in Chrome). I then point my browser to:
    ... and can view the changes without the need to manually reload.

    NB:Where the port number 5500 is a mystery to me. It does not appear in the script and I don't know how to change it.

  3. how to use live reload in Ubuntu without a browser plugin
  4. NB UPDATE 2015-11-05:This method is now OBSOLETE. I now recommend the method described in my javascript notes

    NB:I've run into some problems with this approach, I now recommend this way.


    Install LiveReload through python (not Guard):

    curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python           
    sudo pip install livereload
    or, alternatively:
    sudo apt-get install python-pip
    sudo pip install livereload
    ... subsequently, cd to the directory containing the files to be monitored and create the following file named Guardfile:
    #!/usr/bin/env python
    from livereload.task import Task
    ... then start LiveReload with (for port 1717):
    livereload -p 1717 .
    Following the above steps that the page is rendered in the following URL: