ro.isdc.wro.extensions.processor.css
Class CssLintProcessor

java.lang.Object
  extended by ro.isdc.wro.extensions.processor.css.CssLintProcessor
All Implemented Interfaces:
ResourcePostProcessor, ResourcePreProcessor

@SupportedResourceType(value=CSS)
public class CssLintProcessor
extends Object
implements ResourcePreProcessor, ResourcePostProcessor

Processor which analyze the css code and warns you found problems. The processing result won't change no matter if the processed script contains errors or not. The underlying implementation uses CSSLint script utility ://github.com/stubbornella/csslint.

Since:
1.3.8
Author:
Alex Objelean

Field Summary
static String ALIAS
           
 
Constructor Summary
CssLintProcessor()
           
 
Method Summary
protected  String createDefaultOptions()
           
protected  CssLint newCssLint()
           
protected  void onCssLintException(CssLintException e, Resource resource)
          Called when CssLintException is thrown.
protected  void onException(WroRuntimeException e)
          Invoked when an unexpected exception occurred during processing.
 void process(Reader reader, Writer writer)
          
 void process(Resource resource, Reader reader, Writer writer)
          
 CssLintProcessor setOptions(String... options)
          Deprecated. 
 CssLintProcessor setOptionsAsString(String options)
           
 
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

CssLintProcessor

public CssLintProcessor()
Method Detail

process

public void process(Resource resource,
                    Reader reader,
                    Writer writer)
             throws IOException

Specified by:
process in interface ResourcePreProcessor
Throws:
IOException

onException

protected void onException(WroRuntimeException e)
Invoked when an unexpected exception occurred during processing. By default the exception is thrown further.


newCssLint

protected CssLint newCssLint()
Returns:
CssLint instance.

process

public void process(Reader reader,
                    Writer writer)
             throws IOException

Specified by:
process in interface ResourcePostProcessor
Throws:
IOException

onCssLintException

protected void onCssLintException(CssLintException e,
                                  Resource resource)
Called when CssLintException is thrown. Allows subclasses to re-throw this exception as a RuntimeException or handle it differently.

Parameters:
e - CssLintException which has occurred.
resource - the processed resource which caused the exception.

setOptionsAsString

public CssLintProcessor setOptionsAsString(String options)
Parameters:
options - a CSV representation of options.

setOptions

@Deprecated
public CssLintProcessor setOptions(String... options)
Deprecated. 

Sets an array of options. Use setOptionsAsString(String) instead.


createDefaultOptions

protected String createDefaultOptions()
Returns:
default options to use for linting.


Copyright © 2008-2013. All Rights Reserved.