robfletcher/gradle-compass

Using gradle-compass with Android with different product flavors

RoelRoel opened this issue · 1 comments

We created an Android app with a webview which shows a local website from the assets folder.

The project has different Product Flavors to generate diffent apps with different styles and content but with the same codebas (native Java and HTML / JS).

For each flavor we want to define a diffent sass file with the colors and tweaks for that specific flavour.

Is it possible to use this within an Android project with different product flavors?

Edit:
This is what I have now...

android.applicationVariants.all { variant ->
    for (output in variant.outputs) {
        def procTask = output.processResources
        def sassTask = project.tasks.create("sassToCss${variant.name.capitalize()}") << {
            //file(variant.processResources.assetsDir)
            println "Assets folder: " + procTask.assetsDir

            def _ccsDir = file("$procTask.assetsDir\\css")
            def _sassDir = file("$procTask.assetsDir\\sass")
            def _imagesDir = file("$procTask.assetsDir\\images")
            def _javascriptsDir = file("$procTask.assetsDir\\js")
            def _fontsDir = file("$procTask.assetsDir\\fonts")


            project.compass{
                cssDir = _ccsDir
                sassDir = _sassDir
                imagesDir = _imagesDir
                javascriptsDir = _javascriptsDir
                fontsDir = _fontsDir
            }
            //compileSass
            project.compileSass.execute()
        }
        procTask.dependsOn(sassTask)
    }
}

It is looking ok now but now I got the error

A problem was found with the configuration of task ':app:compileSass'.
Directory 'C:\Workspaces\App folder\Android\app.jruby\gems' specified for property 'gemPath' does not exist.

The real question is: Can this plugin be used for multiple sass and css folders?