* @param groupName
* the name of the group being processed.
* @return a processor used to detect changes in imported resources.
*/
private ResourcePreProcessor createCssImportProcessor(final AtomicBoolean changeDetected, final String groupName) {
final ResourcePreProcessor cssImportProcessor = new AbstractCssImportPreProcessor() {
@Override
protected void onImportDetected(final String importedUri) {
LOG.debug("Found @import {}", importedUri);
final boolean isImportChanged = isChanged(Resource.create(importedUri, ResourceType.CSS), groupName);
LOG.debug("\tisImportChanged={}", isImportChanged);
if (isImportChanged) {
changeDetected.set(true);
// we need to continue in order to store the hash for all imported resources, otherwise the change won't be
// computed correctly.
}
};
@Override
protected String doTransform(final String cssContent, final List<Resource> foundImports)
throws IOException {
// no need to build the content, since we are interested in finding imported resources only
return "";
}
@Override
public String toString() {
return CssImportPreProcessor.class.getSimpleName();
}
};
/**
* Ignore processor failure, since we are interesting in detecting change only. A failure is treated as lack of
* change.
*/
final ResourcePreProcessor processor = new ExceptionHandlingProcessorDecorator(cssImportProcessor) {
@Override