Gradle CSS Plugin

A Gradle plugin for working with CSS.

License

License

Categories

Categories

Gradle Build Tools
GroupId

GroupId

com.eriwen
ArtifactId

ArtifactId

gradle-css-plugin
Last Version

Last Version

1.11.1
Release Date

Release Date

Type

Type

jar
Description

Description

Gradle CSS Plugin
A Gradle plugin for working with CSS.
Project URL

Project URL

https://github.com/eriwen/gradle-css-plugin
Source Code Management

Source Code Management

https://github.com/eriwen/gradle-css-plugin

Download gradle-css-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/com.eriwen/gradle-css-plugin/ -->
<dependency>
    <groupId>com.eriwen</groupId>
    <artifactId>gradle-css-plugin</artifactId>
    <version>1.11.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.eriwen/gradle-css-plugin/
implementation 'com.eriwen:gradle-css-plugin:1.11.1'
// https://jarcasting.com/artifacts/com.eriwen/gradle-css-plugin/
implementation ("com.eriwen:gradle-css-plugin:1.11.1")
'com.eriwen:gradle-css-plugin:jar:1.11.1'
<dependency org="com.eriwen" name="gradle-css-plugin" rev="1.11.1">
  <artifact name="gradle-css-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.eriwen', module='gradle-css-plugin', version='1.11.1')
)
libraryDependencies += "com.eriwen" % "gradle-css-plugin" % "1.11.1"
[com.eriwen/gradle-css-plugin "1.11.1"]

Dependencies

compile (2)

Group / Artifact Type Version
com.yahoo.platform.yui : yuicompressor jar 2.4.7
com.asual.lesscss : lesscss-engine jar 1.3.0

test (1)

Group / Artifact Type Version
org.spockframework : spock-core jar 0.6-groovy-1.8

Project Modules

There are no modules declared in this project.

Quick Start Build Status

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

Gradle 2.1+

plugins {
  id "com.eriwen.gradle.css" version "2.14.0"
}

Gradle 2.0-

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

// 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.asFileTree
    dest = "${buildDir}/styles"
}

Supports CSS Lint v0.9.10

csslint {
    source = css.source.dev.css.files
    dest = "${buildDir}/csslint.out"
}

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) format = 'compact' (default), 'text', 'lint-xml', or 'checkstyle-xml'
  • (Optional) warnings = (default is all) Collection of string ids for checks. Try csslint --list-rules to see all possible IDs
  • (Optional) 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!

Versions

Version
1.11.1
1.11.0
1.8.3
1.8.2
1.8.0
1.2.1
1.1.2
1.1.1
1.1
1.0
0.3
0.2
0.1