Scalatex icon indicating copy to clipboard operation
Scalatex copied to clipboard

auto refresh page feature?

Open mcdoyaji opened this issue 8 years ago • 2 comments

how can browse auto-refresh after readme/run?

I try this with Itellij chrome live edit feature.

but it's not working well.

I want to use workbench. but don't know how.

mcdoyaji avatar Jul 27 '17 07:07 mcdoyaji

here's partial solution.

add below strings into build.sbt

/*
  For openDocument after scalatext document compiled

  maybe defining task in readme project is better than this.
  // http://www.scala-sbt.org/0.13/docs/Howto-After-Input-Task.html

 */
lazy val openDocument = TaskKey[Unit]("openDocument", "openbrowser")

// TODO: refresh browsers tab has current targetURI. 
openDocument := {
  val target = baseDirectory.value / "readme/target/scalatex/index.html"
  java.awt.Desktop.getDesktop.browse(target.toURI)
}

addCommandAlias("dc", ";readme/run;openDocument")

and then run sbt dc

it will open browser after scalatex compile.

but, I can't find how to refresh browser tab has same uri.

anyone know that?

mcdoyaji avatar Aug 04 '17 01:08 mcdoyaji

Here's what I use

$ cat ~/dotfiles/bin/watchscalatex.sh
browser-sync start --server --files "readme/target/scalatex/**" --startPath "/readme/target/scalatex"

I then keep ~readme/run and watchscalatex.sh running in two separate terminal consoles.

olafurpg avatar Aug 13 '17 20:08 olafurpg