chromesync icon indicating copy to clipboard operation
chromesync copied to clipboard

Keep code in Chrome in sync with your filesystem

Chrome Sync

Keep scripts in Google Chrome in sync with your filesystem. Uses the Chrome Remote Debugger to check which scripts are in use in the browser and to update them when the files change.

It's great for those of us who are doing a lot of frontend work. I built it for my AngularJS projects.

Bug reports to https://github.com/aidos/ChromeSync/issues

Note

This is in very eary stages - use at your own risk. It could totally kill your cat. I only just got it working and have barely tested it - there are bound to be a million issues.

The Chrome interfacing code comes from the Sublime Plugin. We're using their WIP and websocket code. Do whatever you want with the rest of the code.

This uses inotify which is a linux only api. It's not going to work on any other platform (without a lot more work).

Install

pip install -r requirements.txt

Edit config.py to add the paths on your local system (make sure your trailing slashes are the same).

Run

Start Chrome with the remote debugger. On a mac it's the following (not sure on linux):

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222

Run the watcher

# If you want to tunnel the traffic to a virtual machine (as I do).
# ssh -R 9222:localhost:9222 your_machine

$ python
>>> import sync
>>> cw = sync.ChromeWatch()

To stop

>>> # To stop you need to run this before leaving ipython
>>> # otherwise the threads will hang and you'll have to manually kill
>>> cw.stop()

TODO

  • Deal with clean up after a tab is closed completely
  • Multiple urls could map to the same file (not handled at the moment)