use of com.squarespace.template.ReferenceScanner in project template-compiler by Squarespace.
the class TemplateC method stats.
/**
* Scan the compiled template and print statistics.
*/
protected int stats(String templatePath, boolean preprocess) throws CodeException, IOException {
String template = readFile(templatePath);
CompiledTemplate compiled = compiler().compile(template, false, preprocess);
ReferenceScanner scanner = new ReferenceScanner();
scanner.extract(compiled.code());
ObjectNode report = scanner.references().report();
String result = GeneralUtils.jsonPretty(report);
System.out.println(result);
return 0;
}
Aggregations