Auto-Refresh for Play Framework Apps

Over this past weekend I built a little tool for Play Framework app developers which auto-refreshes an app in Chrome when the source code or static assets change.

Check out a video demonstration:

For information on how to set it up, check out the project on GitHub:
https://github.com/jamesward/play-auto-refresh

Special thanks to Josh Suereth for helping me figure out the SBT magic.

This entry was posted in Play Framework. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • http://twitter.com/a_thieriot Aurélien Thieriot

    Hi James,

    Great work !
    I just wanted to know if you used the LiveReload protocol to do this?
    And if not, is there a reason why?

    Will make Play! development almost magic :)

    Aurélien

    • http://www.jamesward.com James Ward

      Not right now but it could! It uses a WebSocket that just says “reload” and then JavaScript refreshes the page. Simple but could definitely be improved.

  • Maxence Warzecha

    Sounds very good. Trying right now!

  • pavan bangaram

    Great tutorial..! Than x for this.!

  • http://www.facebook.com/kipriz Andrey Volkov

    It should be built-in functionality! Just great!

  • James Lee

    Hi James, awesome work! Is it possible for you to make this extension to be compatible for Play 1.2.5 as well? :)

    • http://www.jamesward.com James Ward

      I don’t think so since this requires file system watchers which Play 1.x doesn’t have.

  • Kevin

    Hi James – does this work for when I modify `index.scala.html`? Thanks.

    • http://www.jamesward.com James Ward

      It should work with all modifications.

  • Ankit SR

    hi James, i m working on a play project, i want to switch between different pages without refreshing them.
    can you plz help me…

  • Pingback: Scala with SublimeText | In translation()

  • Anjan Pathak

    Thanks James but what is build.sbt. Cannot seem to find it in a play application

  • Ivan Lagunov

    Thanks a lot! Indeed is it planned to make it built-in functionality?

    • http://www.jamesward.com James Ward

      Possibly in the future.

  • Franck

    Hi James,

    it seems great unfortunately I’ve got an error when I add com.jamesward.play.BrowserNotifierPlugin.livereload: _*
    in the settings in my Build.scala :
    val main = play.Project(appName, appVersion, appDependencies).settings(
    com.jamesward.play.BrowserNotifierPlugin.livereload: _*,
    scalacOptions += “-feature”,
    closureCompilerOptions += “ecmascript5″,

    […]
    )

    I’m sure I’ve missed something as the syntax is still esoteric to me!

    • http://www.jamesward.com James Ward

      Try:

      val main = play.Project(appName, appVersion, appDependencies).settings(
      com.jamesward.play.BrowserNotifierPlugin.livereload: _*).settings(
      scalacOptions += "-feature",
      closureCompilerOptions += "ecmascript5")



  • View James Ward's profile on LinkedIn