private String parseCss ( final String css ) { // map containing variables & their values final Map < String , String > map = new HashMap < String , String > ( ) ; final StringBuffer sb = new StringBuffer ( ) ; final Matcher m = PATTERN_VARIABLES_DEFINITION . matcher ( css ) ; while ( m . find ( ) ) { final String variablesBody = m . group ( 1 ) ; // LOG.debug("variables body: " + variablesBody); // extract variables map . putAll ( extractVariables ( variablesBody ) ) ; // remove variables definition m . appendReplacement ( sb , "" ) ; } m . appendTail ( sb ) ; // LOG.debug("replaced variables: " + result); return replaceVariables ( sb . toString ( ) , map ) ; }
Parse css find all defined variables & replace them .