This library is deprecated. You can still use it. It is not going any where.
However, it is not maintained anymore.
Gradle plugin to download and run Sass. Compatible with Gradle continuous build.
This plugin is compatible with Kotlin Gradle DSL & offers the exact same API between Groovy & Kotlin DSLs.
The Sass source files must, by default, be located in src/main/sass
.
plugins {
id("com.github.salomonbrys.gradle.sass") version "1.2.0"
}
By default, the plugin downloads Dart-Sass (Sass official implementation).
If need be, you can configure the download:
sass {
download {
version = "1.13.4" // Default: "0.14.3".
downloadBaseUrl = "http://mirror.example.com" // Default: "https://github.com/sass/dart-sass/releases/download".
outputDir = file("wherever/I/want") // Default: "$gradleUserHome/sass".
}
}
You can instruct the plugin to run a locally installed version of sass instead of downloading a release:
sass {
local()
}
You can configure the path to use:
sass {
local {
path = "/opt/dart-sass/sass" // Default: "sass".
}
}
By default, the plugin creates a sassCompile
task of type SassTask
.
You can configure the output directory:
sassCompile {
outputDir = "web/css" // default: "$buildDir/sass".
}
You can configure the sourcemap generation to be in a file:
sassCompile {
fileSourceMap() // This is the task's default
}
You can configure it:
sassCompile {
fileSourceMap {
embedSource = true // Default: false.
url = absolute // Valid values: relative, absolute. Default: relative.
}
}
You can configure the sourcemap generation to be embedded in the generated CSS:
sassCompile {
embedSourceMap()
}
You can configure it:
sassCompile {
embedSourceMap {
embedSource = true // Default: false.
}
}
You can configure no sourcemap generation at all:
sassCompile {
noSourceMap()
}
You can configure the CSS output style to expanded (by default) or compressed:
sassCompile {
style = compressed // Valid values: expanded, compressed. Default: expanded.
}
SassTask
tasks are SourceTasks
, which means you can configure them just like any SourceTask
:
sassCompile {
source = fileTree("src/whynot/css")
include { /*...*/ }
exclude { /*...*/ }
}
You can easily create SassTask
tasks:
Groovy DSL:
task("mySassCompile", type: SassTask) {
source = fileTree("src/main/my-sass")
}
Kotlin DSL:
task<SassTask>("mySassCompile") {
source = fileTree("src/main/my-sass")
}