class ThemeCssFilesProcessor extends ThemeFilesProcessor {

    protected String rewriteCssUrls(String css, File mergeFile, File mergedFile) throws IOException {
        String urlAdjustment = ThemeBuilderUtils.calculatePathToFile(mergedFile, mergeFile);

        if (StringUtils.isBlank(urlAdjustment)) {
            // no adjustment needed
            return css;
        }

        // match all URLs in css string and then adjust each one
        Pattern urlPattern = Pattern.compile(ThemeBuilderConstants.Patterns.CSS_URL_PATTERN);

        Matcher matcher = urlPattern.matcher(css);

        StringBuffer sb = new StringBuffer();
        while (matcher.find()) {
            String cssStatement = matcher.group();

            String cssUrl = null;
            if (matcher.group(1) != null) {
                cssUrl = matcher.group(1);
            } else {
                cssUrl = matcher.group(2);
            }

            if (cssUrl != null) {
                // only adjust URL if it is relative
                String modifiedUrl = cssUrl;

                if (!cssUrl.startsWith("/")) {
                    modifiedUrl = urlAdjustment + cssUrl;
                }

                String modifiedStatement = Matcher.quoteReplacement(cssStatement.replace(cssUrl, modifiedUrl));

                matcher.appendReplacement(sb, modifiedStatement);
            }
        }

        matcher.appendTail(sb);

        return sb.toString();
    }

    public  ThemeCssFilesProcessor(String themeName, File themeDirectory, Properties themeProperties,
            Map<String, File> themePluginDirsMap, File workingDir, String projectVersion);

}