Class CSSCompressor
java.lang.Object
com.iizix.js.build.compressors.CSSCompressor
Strips comments and whitespace from CSS input.
IIZI's in-process CSS minifier, used through com.iizix.js.build.Compressor or directly through compress(String) and compress(String, String). It is safe rather than maximal: it never reorders, merges or drops a declaration that means something, and it leaves the value of a custom property as its author wrote it.
- Author:
- paulh, Barry van Oudtshoorn, Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException thrown when a web resource can't be minified.Constructor Summary
ConstructorsConstructorDescriptionCreates aCSSCompressor, which can minify any number of stylesheets.Method Summary
Constructor Details
CSSCompressor
public CSSCompressor()Creates aCSSCompressor, which can minify any number of stylesheets.
Method Details
compress
Minifies a stylesheet.- Parameters:
css- The stylesheet.- Returns:
- The minified stylesheet.
- Throws:
IOException- If the stylesheet isnullor cannot be minified: the message says what is wrong and where (line and column).
compress
Minifies a stylesheet and names its source in a failure.- Parameters:
css- The stylesheet.sourceName- The name of the stylesheet's source for the message of a failure, typically the path of its file, ornullwhen it has none.- Returns:
- The minified stylesheet.
- Throws:
IOException- If the stylesheet isnullor cannot be minified: the message names the source and says what is wrong and where (line and column).
minify
Returnssource, minified.- Parameters:
source- a stylesheet- Returns:
source, minified- Throws:
CSSCompressor.MinificationException- ifsourcecan't be minified