Skip to content

cgendreau/gradle-css-plugin

This branch is 66 commits behind eriwen/gradle-css-plugin:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a006a86 · Oct 25, 2012

History

60 Commits
Jul 31, 2012
Sep 23, 2012
Mar 10, 2012
Sep 6, 2012
Sep 23, 2012
Sep 28, 2011
Sep 23, 2012
Oct 25, 2012
Jul 27, 2012
Sep 28, 2011
Oct 25, 2012

Repository files navigation

Quick Start Build Status

Managing your CSS in a Gradle build is super easy now! Just add this to your build.gradle file:

// Grab the plugin from a Maven Repo automatically
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.eriwen:gradle-css-plugin:1.1.1'
    }
}

// Invoke the plugin
apply plugin: 'css'

// Declare your sources
css.source {
    dev {
        css {
            srcDir "app/styles"
            include "*.css"
            exclude "*.min.css"
        }
    }
}

// Specify a collection of files to be combined, then minified and finally GZip compressed.
combineCss {
    source = css.source.dev.css.files
    dest = "${buildDir}/all.css"
}

minifyCss {
    source = combineCss
    dest = "${buildDir}/all-min.css"
    yuicompressor { // Optional
        lineBreakPos = -1
    }
}

gzipCss {
    source = minifyCss
    dest = "${buildDir}/all.2.0.4.css"
}

Supports CSS Lint v0.9.8

csslint {
    source = css.source.dev.css.files
    dest = "${buildDir}/csslint.out"
    options { // Optional
        format = 'lint-xml'
        warnings = ['box-model', 'empty-rules', 'duplicate-properties']
        errors = []
    }
}

Available Tasks and Options

combineCss

  • source = Collection of file paths of files to merge
  • dest = File/String Path for combined output

minifyCss (Uses the YUI Compressor)

  • source = File to minify
  • dest = File for minified output
  • (Optional) yuicompressor.lineBreakPos = -1 (default) Insert a line break after the specified column number

gzipCss

  • source = File to compress
  • dest = File/String path for compressed output

csslint

  • source = Collection of file paths of files to analyze
  • dest = File for output
  • (Optional) options.format = 'compact' (default), 'text', 'lint-xml', or 'checkstyle-xml'
  • (Optional) options.warnings = (default is all) Collection of string ids for checks. Try csslint --list-rules to see all possible IDs
  • (Optional) options.errors = (default is none) Collection of string ids for checks. CAUTION: These cause a non-zero exit code and fail the build!

What, you want more? Let me know!

See Also

The Gradle JS Plugin!

About

Gradle plugin for working with CSS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 87.6%
  • Groovy 9.7%
  • Shell 1.4%
  • Java 1.3%