Code Monkey home page Code Monkey logo

gradle-sass's Introduction

DEPRECATED - replaced with Dart SASS Compiler/Plugin

Jsass is no longer supported

Forked from Fabric3 Sass Plugin

The Gradle Sass plugin provides compilation of Sass files as part of a Gradle build. The plugin is based on the LibSass library (http://sass-lang .com/libsass) for fast compilation. The Fabric3 Sass plugin is licensed under the Apache 2.0 License.

Use

Add the plugin dependency to your build script:

buildscript {
     dependencies {
        classpath group: 'com.tastyworks', name: 'gradle-sass', version: '<version>'
     }
}

apply the plugin:

apply plugin: 'gradle-sass'

and optionally configure it:

sass {
    inputFilePath = "src/main/webapp/assets/scss/app.scss"
    includePaths "src/main/webapp/assets/app/scss"
    outputFilePath = "build/sass/scss/app.css"
}

Note paths are interpreted relative to the current project path.

The plugin will add the 'compileSass' task to your project. Further tasks can be added to copy the compiled output and create a web app:

task copyCompiledCss(type: Copy) {
     from("${buildDir}/sass/scss/app.css")
     into("${buildDir}")
}

task prepareWebAssets(dependsOn: ['someOtherTask', 'compileSass', 'copyCompiledCss']) << {

}

Configuration

The following plugin properties may be configured:

  • inputSyntax: The input syntax, 'scss' (default) or 'sass'
  • outputStyle: The output style, 'nested' (default), 'compact', 'compressed', or 'expanded'
  • inputFilePath: The main Sass file path, relative to the current project path
  • outputFilePath: The compiled file path, relative to the current project path
  • sourceMapPath: The source map file path, relative to the current project path
  • includePaths: A comma separated list of paths to include as part of the compilation, relative to the current project path
  • sourceComments: true if inline source comments should be generated (default false)
  • omitSourceMapping: true if the sourceMappingUrl should be omitted in CSS output (default false)
  • embedSourceMap: true if sourceMappingUrl should be embedded as a data uri (default false)
  • sourceMapContents: true if include contents should be embedded in source maps (default false)
  • precision: sets the decimal precision (default 5)

Watch-based Compilation

To execute Sass compilation based on a gradle watch (i.e. pickup Sass changes and compile automatically) use a Gradle watch:

./gradlew -t :project:compileSass

Building the Source

Requirements are JDK 8.

To build the source, execute the Gradle script, e.g. on *Nix:

./gradlew

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.