/** parses the CSS according to the specified configuration */
public ParserResult parse() throws StyleParserException, QuickFixException {
// determine the output compression level based on the aura mode
Mode mode = Aura.getContextService().getCurrentContext().getMode();
StyleWriter writer = mode.prettyPrint() ? StyleWriter.inline() : StyleWriter.compressed();
if (!runtime) {
// write annotated comments out on the initial pass, in case the runtime pass needs them
writer.writeComments(true, true);
}
// do the parsing
CssErrorManager em = new CssErrorManager(resourceName);
PluginRegistry registry = Omakase.source(content).add(plugins).add(writer).add(em).process();
// report any errors found during parsing
em.checkErrors();
// return the results
ParserResult result = new ParserResult();
result.content = writer.write();
if (registry.retrieve(ThemeFunctionPlugin.class).isPresent()) {
result.themeExpressions = registry.retrieve(ThemeFunctionPlugin.class).get().parsedExpressions();
}