Compile the scss for the WAR for Vaadin with grails

While running with run-app and in developer mode, Vaadin will compile the styles.scss on the fly for you. But once you want to roll your WAR file for deployment, you have to do this on your own (in plain Java, the Maven file from Vaadin will take care I guess)

Create or add scripts/_Events.groovy and change the theme var there

import com.vaadin.sass.internal.ScssStylesheet

eventCreateWarStart = { name, stagingDir ->
    def theme = "<themename>"
    def root = "${stagingDir}/VAADIN/themes/${theme}"
    ScssStylesheet scss = ScssStylesheet.get("${root}/styles.scss");
    scss.compile()
    def outFile = new File("$root/styles.css")
    outFile.write(scss.toString())
}

Bonus points: make the script find all themes; delete the *.scss files from the war.