Less CSS compiler written in Java
CSS Java
Latest commit 6365242 Nov 19, 2016 @Horcrux7 Horcrux7 Switch version to 1.6

README.md

JLessC

Build Status License Coverage Status Download

JLessC is a Less CSS compiler written completely in Java (pure Java). It does not need any additional libraries at runtime (no JavaScript, no ANTLR). The main target of the project is performance and compatibility to Bootstrap.

Required Java Version

JlessC requires Java SE 7 or higher. It is tested with Java SE 7 and 8 on travis-ci.org.

Add Dependency

Gradle users should add the library using the following dependency:

dependencies {
    compile 'de.inetsoftware:jlessc:+'
}

If you want to test a snapshot version with the latest bug fixes, then add the snapshot repository:

repositories {
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots/"
    }
    jcenter() // or any other repository that you use
}

Maven users should add the library using the following dependency:

<dependency>
  <groupId>de.inetsoftware</groupId>
  <artifactId>jlessc</artifactId>
  <version>RELEASE</version>
</dependency>

Usage

Check out the sources or download the binary and add it to your Java project. The following code sequence shows a sample usage:

import com.inet.lib.less.Less;
...

// Compile Less data to CSS output
String css = Less.compile( null, "@bgcol: red; #row { background-color: @bgcol; }", true );

API details can be found in the source of the Less class.

Benchmark

JLessC runs a benchmark test on the Travis build system using different less compilers. We always use the latest version of every compiler. We measure the compile time of the Bootstrap sample in our test suite. The table shows a result for Java SE 8. Of course the values can change over the time.

Tool Time
JLessC ~400 ms
less.js via Exec call to nodeJS ~850 ms
Official LESS CSS Compiler for Java ~4400 ms
LESS Engine ~10800 ms

Alternative libraries

Reference usage

We use JLessC in our reporting software i-net Clear Reports for user customized themes.