Package com.helger.css.writer
Class CSSCompressor
java.lang.Object
com.helger.css.writer.CSSCompressor
Utility class to compress CSS content
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetCompressedCSS(String sOriginalCSS, ECSSVersion eCSSVersion) Get the compressed version of the passed CSS code.static StringgetCompressedCSS(String sOriginalCSS, ECSSVersion eCSSVersion, boolean bRemoveUnnecessaryCode) Get the compressed version of the passed CSS code.static StringgetRewrittenCSS(String sOriginalCSS, CSSWriterSettings aSettings) Get the rewritten version of the passed CSS code.
-
Method Details
-
getCompressedCSS
@Nonnull public static String getCompressedCSS(@Nonnull String sOriginalCSS, @Nonnull ECSSVersion eCSSVersion) Get the compressed version of the passed CSS code.- Parameters:
sOriginalCSS- The original CSS code to be compressed.eCSSVersion- The CSS version to use.- Returns:
- If compression failed because the CSS is invalid or whatsoever, the original CSS is returned, else the compressed version is returned.
-
getCompressedCSS
@Nonnull public static String getCompressedCSS(@Nonnull String sOriginalCSS, @Nonnull ECSSVersion eCSSVersion, boolean bRemoveUnnecessaryCode) Get the compressed version of the passed CSS code.- Parameters:
sOriginalCSS- The original CSS code to be compressed.eCSSVersion- The CSS version to use.bRemoveUnnecessaryCode- iftrueunnecessary empty declarations are omitted- Returns:
- If compression failed because the CSS is invalid or whatsoever, the original CSS is returned, else the compressed version is returned.
-
getRewrittenCSS
@Nonnull public static String getRewrittenCSS(@Nonnull String sOriginalCSS, @Nonnull CSSWriterSettings aSettings) Get the rewritten version of the passed CSS code. This is done by interpreting the CSS and than writing it again with the passed settings. This can e.g. be used to create a compressed version of a CSS.- Parameters:
sOriginalCSS- The original CSS code to be compressed.aSettings- The CSS writer settings to use. The version is used to read the original CSS.- Returns:
- If compression failed because the CSS is invalid or whatsoever, the original CSS is returned, else the rewritten version is returned.
-