Play Plugin and Sass Assets


I’m trying to a gradle project from SBT to Gradle and I’ve got a problem.
I wanna compile the sass to css and then include it into the binary.
I’ve found something similar here Gradle + Play: Configuring CSS sources
but @eriwen uses Less and not SASS. Overmore the does not show his LessCompileTask which I would need to create something similar for SASS.

Current approach:

model {
    components {
        play {
            platform play: playVersion, scala: scalaVersion, java: '1.8'
            injectedRoutesGenerator = true

            sources {
                twirlTemplates {
                    defaultImports = TwirlImports.SCALA

            binaries.all { binary ->
                tasks.create("${}Sass", SassCompileTask) { sassTask ->
                    source "app/assets/stylesheets"
                    exclude ["**/_*.scss", "**/_*.sass"]

                    dest = "${buildDir}/tmp/${}"


The SassCompileTask comes from the applied plugin but it still says: No such property: SassCompileTask for class:

Current build.gradle:

Thanks for your help,

I think first you may need to explicitly import or fully qualify SassCompileTask:

tasks.create("${}Sass", org.kravemir.gradle.sass.SassCompileTask) { ... }

Oh yeah thank you. Unfortunatly, the sass plugin is very outdated (the compiler) so it throws stupid errors. If anyone knows a good gradle sass plugin in which task I could hook into please message me.

I wish I did. Getting Sass to work especially with Play would be a huge pain I’m afraid. If you find a solution, let me know as well.

@eriwen Is working? I hooked into the task and specified the directory like this:

sourceDir = file("$projectDir/app/assets/stylesheets")
destDir = file("${buildDir}/tmp/${}")


But executing the task gives me NO-SOURCE

I’m afraid I never finished that task.

When I did all this stuff for a previous employer, I had to write a bunch of custom tasks for things like this, that I could not open source.

Unless you’re willing to do that, I would recommend not using Gradle for your Play app. If you are, though, and can open source your work, I will help you promote the heck out of it :slight_smile:

We want to switch because of speed reasons (sbt is slooow) and in additon to that all our jvm projects are using gradle on this organization. Our work is open source:

If you think it’s really not good to use gradle tell me, otherwise we would really want the switch.

All I can say is that it took me a month to convert, which is far longer than I expected.

SBT is quite painful. I do fully get that. A decent number of folks are using Gradle with Play, but they all seem to have a bunch of their own tooling to do it.

I regret that I cannot afford to spend time making this better, as I have some bigger things in work. I would recommend you go forward developing some Gradle plugins for this. One rather unknown plugin that may help you as it helped me is a digest plugin. I should publish that to the plugin portal I suppose, if you think you’d find that helpful.