Run a task when any file in given directory is changed in SBT?
sbt
Solution
Take a look at the documentation for triggered execution. You can configure the watched directory using the `watchSources` setting. This is a bit trickier as only Scala source files will be watched by default, so we need to specify an appropriate path finder:
watchSources <++= baseDirectory map { path =>
((path / "src/main/jade") ** "*.jade").get }
The `watchSources` setting is not scoped, so you will need to watch all sources at once. Then you just have to run:
~jadeCompile
Problem
Is there a way to run a task on every code change in a given directory? Preferably, something that works well with `~` operator in SBT so that I could do: ``` ~jadeCompile ``` to run custom `jadeCompile` task.