Git Product home page Git Product logo

gradle-sass's Introduction

DEPRECATED

This library is deprecated. You can still use it. It is not going any where.

However, it is not maintained anymore.

Gradle Sass

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.

Install

plugins {
    id("com.github.salomonbrys.gradle.sass") version "1.2.0"
}

Sass access configuration

Download

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

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

Sass execution configuration

By default, the plugin creates a sassCompile task of type SassTask.

Output

You can configure the output directory:

sassCompile {
    outputDir = "web/css" // default: "$buildDir/sass".
}
Source map

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()
}
Style

You can configure the CSS output style to expanded (by default) or compressed:

sassCompile {
   style = compressed  // Valid values: expanded, compressed. Default: expanded.
}
Sources

SassTask tasks are SourceTasks, which means you can configure them just like any SourceTask:

sassCompile {
    source = fileTree("src/whynot/css")
    include { /*...*/ }
    exclude { /*...*/ }
}
Create new taks

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")
}

gradle-sass's People

Contributors

salomonbrys 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.