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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With