Giter VIP home page Giter VIP logo

gradle-sass's Introduction

Gradle Sass Plugin

This is a plugin for sass preprocessing in gradle. It uses vaadin-sass-compiler.

Usage

You should clone this repository locally and install the jar in the local maven repository

    ./gradlew publishToMavenLocal

In your build.gradle add the following at the start of the script:

    buildscript {
        repositories {
            mavenLocal()
        }
        dependencies {
            classpath "it.tellnet:gradle-sass:+"
        }
    }

Proceed to configure the plugin.

WebJars support

This plugin supports webjars. There are 2 additional configurations added to the project:

  • sassCompile
  • sassRuntime

Example:

    sassRuntime 'org.webjars.npm:github-com-mrkelly-lato:0.3.0'
    sassRuntime 'org.webjars.bower:open-iconic:1.1.1'

These configurations just resolve dependencies and add them to the search path for scss files. Thus it is possible to add webjars like bootstrap-sass to dependencies. In order to add sassRuntime deps to java runtime deps use the following snippet

    configurations.runtime.extendsFrom configurations.sassRuntime

Defined Tasks

There are 3 tasks defined:

  • sassCompile - Compiles sass files to css
  • sassWatchStart - Watches sassDir for changes and compiles them on changes. Depends on sassCompile
  • sassWatchStop - Stops the thread started by sassWatchStart

Configuration

To configure this plugin you can declare a block as follows:

sass {
    //The input directory
    sassDir = 'src/main/sass' //default value
    //The output directory
    cssDir = 'build/sass' //default value
    //Minify output css
    minify = false //default value
    //Vaadin sass compiler is pretty verbose about errors
    silenceErrors = false //default value
    
    /*
    //You can add scan directories to look for SCSS files in the JARs
    //Search in dep jars looks for these directories
    searchDirectories '/META-INF/resources/webjars/open-iconic/1.1.1/font/css/',
                      '/META-INF/resources/webjars/github-com-mrkelly-lato/0.3.0/scss/'
    */
    
}

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.