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

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

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

Important node: this processor is not cross platform and has some pre-requesites in order to work.

Same as RhinoLessCssProcessor but uses lessc shell utility to process the less.

Installation instructions: Install the libnode-less package (Unix OS)

   sudo apt-get install node-less
 
It is possible to test whether the lessc utility is available using isSupported()

Since:
1.5.0
Author:
Alex Objelean

Field Summary
static String ALIAS
           
 
Constructor Summary
NodeLessCssProcessor()
           
 
Method Summary
protected  String[] getCommandLine(String filePath)
          Creates the platform specific arguments to run the lessc shell utility.
 boolean isSupported()
           
protected  void onException(Exception e, String content)
          Invoked when a processing exception occurs.
 void process(Reader reader, Writer writer)
          
 void process(Resource resource, Reader reader, Writer writer)
          
 
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

NodeLessCssProcessor

public NodeLessCssProcessor()
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(Exception e,
                           String content)
Invoked when a processing exception occurs. Default implementation wraps the original exception into WroRuntimeException.

Parameters:
e - the Exception thrown during processing
content - the resource content being processed.

process

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

Specified by:
process in interface ResourcePostProcessor
Throws:
IOException

isSupported

public boolean isSupported()
Specified by:
isSupported in interface SupportAware
Returns:
true if the processor is supported on this environment. The implementation check if the required shell utility is available.

getCommandLine

protected String[] getCommandLine(String filePath)
Creates the platform specific arguments to run the lessc shell utility. Default implementation handles windows and unix platforms.

Returns:
arguments for command line. The implementation will take care of OS differences.


Copyright © 2008-2013. All Rights Reserved.