In this post, I decided that I would learn about sbt tasks and create it myself. I reached the stage where I created a task that runs before compilation and compiles my sass.
val sassCompile = TaskKey[ Unit ]( "sassCompile" ) sassCompile := { SassCompiler.compile( baseDirectory.value ) } watchSources <++= baseDirectory map { path => ((path / "app" / "assets" ) ** "*.scss").get } compile <<= (compile in Compile) dependsOn sassCompile
I do two things:
- Make sure every change to scss trigger compilation
- Before compiling, the sass compiler starts
So what works:
- Started working with compilation. Every time I change my scala, compilation triggers. (Normal behavior). Every time I change .scss inside the specified path: app / assets / **, compilation triggers. All perfectly.
- When I manually record the compilation to the playback console, the sass compilation also starts, and I can see the css file change.
What does not work:
When compilation starts automatically (by calling ~ compile or ~ run and then making changes (or not even making changes), sass compilation is not called. Therefore, when I play ~ run, my sass compiler is not called.
EDIT: if that helps, here is a similar question.
source share