SassParser parser = new SassParser(new StringReader(withImports));
SassSheet sheet = parser.parse(file.getParentFile());
SassSheetEvaluator evaluator = new SassSheetEvaluator(new JavaStringInterpolator());
evaluator.addFunction("formatProperty", new IFunction() {
public IPropertyValue evaluate(List<IPropertyValue> params)
throws EvaluationException {
if ("test".equals(((DefaultPropertyValue) params.get(0)).getValue())) {
return new NumberPropertyValue("3");
} else if ("title".equals(((DefaultPropertyValue) params.get(0)).getValue())) {
return new DefaultPropertyValue("2");
} else {
return new DefaultPropertyValue("1");
}
}
});
evaluator.evaluate(sheet);
SassSheetSerializer serializer = new SassSheetSerializer(new PrintStream(out));
serializer.render(sheet);
return new String(out.toByteArray());