JLESS is a pure Java port of Alexis Sellier's LESS abstraction for CSS, which was written in Ruby. By using only Java to produce the CSS output, this library offers much faster LESS processing for your Java web application when compared with other approaches that wrap interpreters around the original Ruby or JavaScript source.
JLESS can be used either as a command line tool during your build process, or it can be used at runtime to translate LESS content on demand.
git clone git://github.com/jryans/jless.git
cd jless
mvn package
# Use -c if you'd like to minify the output
java -jar target/jless-<version>-jar-with-dependencies.jar [-c] <input less file>
LessProcessor processor = new LessProcessor();
processor.setCompressionEnabled(true); // Minification is off by default
String css = processor.process(<input stream>).toString();
At this time, not all of the features of the LESS language have been ported over:
- Supported
- Variables
- Mixins
- Mixin Arguments
- Nesting
- Unsupported
- Math Operations
- Accessors
- Imports
Please file issues for any problems you encounter.
- Alexis Sellier: For the initial implementation of the LESS framework
- Mathias: For the parboiled PEG library, which greatly simplified this port
- LESS: The original LESS abstraction in Ruby
- less.js: A newer implementation in JavaScript
- lesscss-engine: Wraps less.js with a JavaScript interpreter for use in Java applications