Package com.inet.lib.less
Class Less
- java.lang.Object
-
- com.inet.lib.less.Less
-
public class Less extends java.lang.ObjectThe main class of JLessC library. Its contain all start points for converting LESS to CSS files.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOMPRESSKey for compress option. true, if the CSS data should be compressed without any extra formating characters.static java.lang.StringREWRITE_URLSRewrites URLs to make them relative to the base less file.
-
Constructor Summary
Constructors Constructor Description Less()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringcompile(java.io.File lessFile, boolean compress)Compile the less data from a file.static java.lang.Stringcompile(java.io.File lessFile, boolean compress, ReaderFactory readerFactory)Compile the less data from a file.static java.lang.Stringcompile(java.net.URL baseURL, java.lang.String lessData, boolean compress)Compile the less data from a string.static java.lang.Stringcompile(java.net.URL baseURL, java.lang.String lessData, boolean compress, ReaderFactory readerFactory)Compile the less data from a string.static java.lang.Stringcompile(java.net.URL baseURL, java.lang.String lessData, java.util.Map<java.lang.String,java.lang.String> options)Compile the less data from a string.static java.lang.Stringcompile(java.net.URL baseURL, java.lang.String lessData, java.util.Map<java.lang.String,java.lang.String> options, ReaderFactory readerFactory)Compile the less data from a string.static voidregisterCustomFunction(java.lang.String name, CustomLessFunction func)Register a custom less function.
-
-
-
Field Detail
-
COMPRESS
public static final java.lang.String COMPRESS
Key for compress option. true, if the CSS data should be compressed without any extra formating characters.- See Also:
- Constant Field Values
-
REWRITE_URLS
public static final java.lang.String REWRITE_URLS
Rewrites URLs to make them relative to the base less file. 'all' rewrites all URLs, 'local' just those starting with a '.', 'off' simple inline it.
-
-
Method Detail
-
compile
public static java.lang.String compile(java.net.URL baseURL, java.lang.String lessData, boolean compress) throws LessExceptionCompile the less data from a string.- Parameters:
baseURL- the baseURL for import of external less data.lessData- the input less datacompress- true, if the CSS data should be compressed without any extra formating characters.- Returns:
- the resulting less data
- Throws:
LessException- if any error occur on compiling.
-
compile
public static java.lang.String compile(java.net.URL baseURL, java.lang.String lessData, boolean compress, ReaderFactory readerFactory) throws LessExceptionCompile the less data from a string.- Parameters:
baseURL- the baseURL for import of external less data.lessData- the input less datacompress- true, if the CSS data should be compressed without any extra formating characters.readerFactory- A factory for the readers for imports.- Returns:
- the resulting less data
- Throws:
LessException- if any error occur on compiling.
-
compile
public static java.lang.String compile(java.net.URL baseURL, java.lang.String lessData, java.util.Map<java.lang.String,java.lang.String> options) throws LessExceptionCompile the less data from a string.- Parameters:
baseURL- the baseURL for import of external less data.lessData- the input less dataoptions- some optional options, see constants for details- Returns:
- the resulting less data
- Throws:
LessException- if any error occur on compiling.
-
compile
public static java.lang.String compile(java.net.URL baseURL, java.lang.String lessData, java.util.Map<java.lang.String,java.lang.String> options, ReaderFactory readerFactory) throws LessExceptionCompile the less data from a string.- Parameters:
baseURL- the baseURL for import of external less data.lessData- the input less dataoptions- some optional options, see constants for detailsreaderFactory- A factory for the readers for imports.- Returns:
- the resulting less data
- Throws:
LessException- if any error occur on compiling.
-
compile
public static java.lang.String compile(java.io.File lessFile, boolean compress) throws java.io.IOExceptionCompile the less data from a file.- Parameters:
lessFile- the less filecompress- true, if the CSS data should be compressed without any extra formating characters.- Returns:
- the resulting less data
- Throws:
java.io.IOException- if an I/O error occurs reading from the less file
-
compile
public static java.lang.String compile(java.io.File lessFile, boolean compress, ReaderFactory readerFactory) throws java.io.IOExceptionCompile the less data from a file.- Parameters:
lessFile- the less filecompress- true, if the CSS data should be compressed without any extra formating characters.readerFactory- A factory for the readers for imports.- Returns:
- the resulting less data
- Throws:
java.io.IOException- if an I/O error occurs reading from the less file
-
registerCustomFunction
public static void registerCustomFunction(@Nonnull java.lang.String name, CustomLessFunction func)Register a custom less function.- Parameters:
name- the non null namefunc- the function
-
-