Sublime Forum

Plugin idea: Reload any browser on saving of a project file

#1

I’ve been using the awesome LiveReload plugin with it’s [xbrower]((like thier [url=https://github.com/mockko/livereload/tree/master/src) does)]xbrower js files to get it to work in safari, chrome, opera and firefox which is great but it doesn’t work in IE or IEtester. I was wondering if there was an easier way to do that this app does in Sublime that didn’t involve installing Ruby, Devkit, gems, running a mini websever and relying on websocket to be enabled (you have to manually enable it in Firefox and Opera).

So my plugin idea is this; you include a js file in the head of your dev site (like xbrowser). This file runs continually checks on itself (or a text file) to see if the time code matches the current time and executes a meta reload of the page if it does. When you save any file in your project Sublime updates the timecode causing a refresh in all browsers. Simple.

I’m no JS programmer so I don’t know is this is possible, or that simple, but if it worked it would be totally awesome!

0 Likes

#2

I could imagine writing a plugin which provides a mini webserver in Python and some Javascript which would poll this. The webserver would then react on the supplied referer header and return the necessary information to it (e.g. true, false). The plugin also has to use the events of st2 in order to know when a file has been saved. The problem is, that you have to include the js code in all your websites or use some local site alteration mechanism. It’s also strictly bound to st2 then. You cannot quickly modify something with e.g. vim. Thus they created a universal solution which is not bound to any editor…

0 Likes

#3

is this a static local page? that wouldn’t be so hard to implement hackishly

0 Likes