Skip to content
LESS CSS Compiler for Java
JavaScript Java
Pull request Compare This branch is 1 commit ahead, 83 commits behind marceloverdijk:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Official LESS CSS Compiler for Java

LESS CSS Compiler for Java is a library to compile LESS sources to CSS stylesheets.

The compiler uses Rhino, Envjs (simulated browser environment written in JavaScript), and the official LESS JavaScript compiler.

Look at the simple example below to compile LESS to CSS:

// Instantiate the LESS compiler
LessCompiler lessCompiler = new LessCompiler();

// Compile LESS input string to CSS output string
String css = lessCompiler.compile("@color: #4D926F; #header { color: @color; }");

// Or compile LESS input file to CSS output file
lessCompiler.compile(new File("main.less"), new File("main.css"));

To learn more about LESS, please see

Getting Started

Maven users should add the library using the following dependency:


Non-Maven users should download the latest version and add it to the project's classpath. Also the following dependencies are required:


The LESS CSS Compiler for Java contains all LESS compatibility tests. All tests pass, except the @import test case which fails partially as the compiler does not support the media query import feature (yet).

The project also contains integration tests for compiling the Twitter Bootstrap ( library. If you are using another 3th party LESS library you want to be added to the integration tests, just create a issue and provide a link to the library.


Have a question, or found an issue? Just create a issue:


Marcel Overdijk

Copyright and License

Copyright 2012 Marcel Overdijk

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Something went wrong with that request. Please try again.