Running less.js by nashorn, convert less
to css
.
使用JDK8+自带的nashorn引擎,实现 less --> css
的转换过程
This project is inspired by less/less.js#2985 , thanks to @artfiedler
less.js version: 2.7.2 without any modify.
LesscService lessc = new LesscService();
lessc.init();
String lessStr = ".class { width: (1 + 3) }";
String cssStr = lessc.render(lessStr);
System.out.println(cssStr);
// output: .class { width: 4 }
mvn package install