ro.isdc.wro.model.resource.processor.impl.css
Class FallbackCssDataUriProcessor

java.lang.Object
  extended by ro.isdc.wro.model.resource.processor.impl.css.AbstractCssUrlRewritingProcessor
      extended by ro.isdc.wro.model.resource.processor.impl.css.CssDataUriPreProcessor
          extended by ro.isdc.wro.model.resource.processor.impl.css.FallbackCssDataUriProcessor
All Implemented Interfaces:
ImportAware, ResourcePostProcessor, ResourcePreProcessor

public class FallbackCssDataUriProcessor
extends CssDataUriPreProcessor

Preserves the original css uri along with the new one. This should work also with browsers which do not support dataURI's.

Sample Input:

 div {
   background: url('image.png');
 }
 
Sample output:
  div {
   background: url('image.png');
   background: url('data:image/png;base64,iVBORw0...');
 }
 
Applies the graceful degradation technique. For example, if browser can't parse second rule, it'll use first one.

Since:
1.4.7
Author:
Alex Objelean

Field Summary
static String ALIAS
           
 
Constructor Summary
FallbackCssDataUriProcessor()
           
 
Method Summary
protected  CssUrlInspector newCssUrlInspector()
           
protected  String replaceDeclaration(String originalDeclaration, String modifiedDeclaration)
          Invoked to replace the entire css declaration.
 
Methods inherited from class ro.isdc.wro.model.resource.processor.impl.css.CssDataUriPreProcessor
getDataUriGenerator, isReplaceAccepted, isReplaceNeeded, replaceImageUrl, replaceWithDataUri
 
Methods inherited from class ro.isdc.wro.model.resource.processor.impl.css.AbstractCssUrlRewritingProcessor
cleanImageUrl, getUrlPrefix, isImportAware, onProcessCompleted, onUrlReplaced, process, process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALIAS

public static final String ALIAS
See Also:
Constant Field Values
Constructor Detail

FallbackCssDataUriProcessor

public FallbackCssDataUriProcessor()
Method Detail

replaceDeclaration

protected String replaceDeclaration(String originalDeclaration,
                                    String modifiedDeclaration)
Invoked to replace the entire css declaration.

An example of css declaration:

 background: url(/image.png);
 
Useful when the css declaration should be changed. The use-case is: FallbackCssDataUriProcessor.

Overrides:
replaceDeclaration in class AbstractCssUrlRewritingProcessor
Parameters:
originalDeclaration - the original, unchanged declaration.
modifiedDeclaration - the changed expression.
Returns:
the expression to apply. By default the modifiedExpression will be returned.

newCssUrlInspector

protected CssUrlInspector newCssUrlInspector()
Overrides:
newCssUrlInspector in class AbstractCssUrlRewritingProcessor


Copyright © 2008-2013. All Rights Reserved.