@Override
public String process(final String filename, final String source, final Config conf,
final ClassLoader loader) throws Exception {
String path = filename;
try {
LessCompiler compiler = new ThreadUnsafeLessCompiler();
LessSource src = new LessStrSource(source, path);
CompilationResult result = compiler.compile(src, lessConf(conf));
result.getWarnings().forEach(warn -> {
log.warn("{}:{}:{}:{}: {}", path, warn.getType(), warn.getLine(),
warn.getCharacter(), warn.getMessage());
});
if (path.endsWith(".map")) {
return result.getSourceMap();
} else {
return result.getCss();
}
} catch (Less4jException ex) {
List<AssetProblem> problems = ex.getErrors().stream()
.map(it -> new AssetProblem(path, it.getLine(), it.getCharacter(), it.getMessage(), null))
.collect(Collectors.toList());
throw new AssetException(name(), problems);
}
}