buildscript {
    repositories {
        mavenLocal()
        jcenter()
    }
    dependencies {
        classpath 'com.eriwen:gradle-css-plugin:2.14.0'
    }
}

repositories {
    jcenter()
}

apply plugin: 'css'

css.source {
    custom {
        css {
            srcDir "src/test/resources"
            include "file*.css"
        }
    }
    compiled {
        css {
            srcDir "src/test/resources"
            include "*.less"
        }
    }
}

task clean(type: Delete) {
    delete buildDir
}

// Combine CSS files
task combine(type: com.eriwen.gradle.css.tasks.CombineCssTask) {
    source = css.source.custom.css.files
    dest = "${buildDir}/all.css"
}

// Minify with YUI Compressor
task minify(type: com.eriwen.gradle.css.tasks.MinifyCssTask) {
    source = combine
    dest = file("${buildDir}/all-min.css")
    yuicompressor {
        lineBreakPos = 100
    }
}

// GZip it!
task gzip(type: com.eriwen.gradle.css.tasks.GzipCssTask) {
    source = minify
    dest = "${buildDir}/all-zipped.min.css"
}

csslint {
    source = css.source.custom.css.files
    dest = "${buildDir}/csslint.out"
    format = 'text'
    warnings = ['box-model', 'ids']
    errors = []
}

lesscss {
    source = css.source.compiled.css.files
    dest = "${buildDir}/styles"
}
