Git Product home page Git Product logo

gradle-css-plugin's Introduction

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.8.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"
}

LESS Support

css.source {
    dev {
        css {
            srcDir "app/styles"
            include "*.less"
        }
    }
}

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

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

less

  • source = Files to transpile
  • dest = File/String output directory

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!

gradle-css-plugin's People

Contributors

cgendreau avatar eriwen avatar mbjarland avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.