[jbosstools-dev] PoC : Browser Refresh in conjunction with the Chrome LiveReload Extension
Yahor Radtsevich
yradtsevich at exadel.com
Sun Jan 6 10:07:06 EST 2013
Hi Xavier,
The video looks great! I like the one click interface (just enable
LiveReload on server).
I wanted to run it on my desktop, but did not found the Chrome and FF
extensions. Are they available somewhere?
Also could you please explain how it works in some technical details?
I.e. about which changes the browser is notified (all published files or
only currently loaded files)?
How it decides to refresh? Does it refreshes the full page? If not, then
does it rerun changed scripts?
Does it handle html content loaded through AJAX (like it is done in jQuery
Mobile)?
Does it handle CSS @import?
What if I change opened html file, will it do a partial refresh or full
refresh?
On Thu, Jan 3, 2013 at 1:15 PM, Xavier Coulon <xcoulon at redhat.com> wrote:
> On Jan 3, 2013, at 9:28 AM, Xavier Coulon wrote:
>
> Hello and Happy New Year to everyone!
>
> Between F2F meeting and Christmas vacations, I spend some time working on
> a PoC of LiveReload from Eclipse.
> [My first iteration was using the Chrome Remote Debugging Protocol, but
> since it required starting Chrome with an extra
> "--remote-debugging-protocol" arg and it was specific to Chrome, I reworked
> on it to turn what's described below]
>
> The PoC implements the server-side of the LiveReload protocol (based on
> websockets).
> 2 things to get it working (once you've checkout the plugin repo on github
> and started an Eclipse Runtime):
>
> * on the Browser side, the user needs to install the LiveReload extension
> * on the Eclipse side, the user starts his AS server and then clicks on
> "Enable LiveReload" on the server menu.
>
> Then, when the use edits html/js/css content, the files are published by
> the server adapter on the AS server and then, the browser is notified of
> the (web) resource changes (with URL and not file location). Then, the
> extension decides which part of the page needs to be refreshed.
> Of course, the notification occurs *after* the html/js/css files have been
> published on the server ;-)
>
> # A few notes: #
>
> * this PoC only works from Server Adapter level, as it made more sense and
> helped me resolve the file URL from the server host/port and the
> application deployment context.
> See the "refresh" command description (
> https://github.com/mockko/livereload/blob/master/docs/WebSocketProtocol.md#file-modified):
> the command must include the URL of the changed file.
> To get notified that the server deployed the resource, I use a
> PublishAdapter, so this is pure generic WTP API.
> The only JBossAS-specific thing I use here is when I need to retrieve the
> server port:
> server.getAttribute("org.jboss.ide.eclipse.as.core.server.webPort",
> "8080")
> but there may be a more portable manner to do it.
>
> - one thing I did not get to work (yet) was the Firefox "LiveReload"
> extension. It looked as if the browser extension was disconnecting
> immediately after connexion, so there was no channel I could use to send
> the "refresh" command. That should be solved, though.
>
> * the http://livereload.com/ doc mentions this hack:
> "How do you stop that snippet from making it into production, then? Well,
> simple: add an IF and check location.host, and then feel free to commit and
> deploy."
> which means that it should be possible to also support Mobile devices and
> BrowserSim if no extension can be installed on them.
>
> The code is at the same location as before:
> https://github.com/xcoulon/jbosstools-pagereload (the old plugin has been
> moved to another branch)
> There's another screencast for that:
> https://www.youtube.com/watch?v=MWoZIQwitSs
> As usual, sound is low and accent is strong, but I'll try to fix that in
> the future ;-)
>
> # Further developments #
>
> Now, this also opens question of support to even wider file types, such as
> SASS/LESS instead of plain CSS:
>
> * should we provide editors for those types (usual stuff: syntax coloring,
> validation, content assist, navigation) ?
> * as far as SASS is concerned, there's no Java implementation of the
> processor. Would writing one in Java help us when it comes to processing
> SASS files to convert them into CSS and publish them ? The only way to do
> it is to invoke the ruby gem with JRuby - I haven't tried it yet, though.
>
> After a little more search, I found these Java implementations for SASS:
> - http://code.google.com/p/jsass/ but licensed under GPLv3
> - https://github.com/darrinholst/sass-java but looks inactive (
> https://github.com/darrinholst/sass-java/graphs/commit-activity) - Last
> release was in May 2011
>
> OTOH, LESS seems to have an "official" Java port:
> https://github.com/marceloverdijk/lesscss-java
>
>
>
>
> All feedback is welcome.
>
> Best regards,
> /Xavier
>
>
>
>
> _______________________________________________
> jbosstools-dev mailing list
> jbosstools-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
>
>
> _______________________________________________
> jbosstools-dev mailing list
> jbosstools-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
>
>
>
> _______________________________________________
> jbosstools-dev mailing list
> jbosstools-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
>
--
Best Regards,
Yahor Radtsevich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20130106/6fa8aa8e/attachment.html
More information about the jbosstools-dev
mailing list