5454@ SuppressFBWarnings (value = { "UWF_UNWRITTEN_FIELD" , "NP_UNWRITTEN_FIELD" }, justification = "set via maven property" )
5555public final class CSSCompressMojo extends AbstractMojo
5656{
57- private static final String [] EXTENSIONS_CSS_COMPRESSED = new String [] { CCSS .FILE_EXTENSION_MIN_CSS ,
58- "-min.css" ,
59- ".minified.css" ,
60- "-minified.css" };
57+ private static final String [] EXTENSIONS_CSS_COMPRESSED = { CCSS .FILE_EXTENSION_MIN_CSS ,
58+ "-min.css" ,
59+ ".minified.css" ,
60+ "-minified.css" };
6161
6262 /**
6363 * The Maven Project.
@@ -180,15 +180,24 @@ public final class CSSCompressMojo extends AbstractMojo
180180 * @parameter property="browserCompliantMode" default-value="false"
181181 * @since 1.4.0
182182 */
183- private boolean browserCompliantMode = false ;
183+ private boolean browserCompliantMode = CSSReaderSettings .DEFAULT_BROWSER_COMPLIANT_MODE ;
184+
185+ /**
186+ * If true the deprecated properties should be kept when reading, otherwise
187+ * they are discarded.
188+ *
189+ * @parameter property="keepDeprecatedProperties" default-value="false"
190+ * @since 7.0.4
191+ */
192+ private boolean keepDeprecatedProperties = CSSReaderSettings .DEFAULT_KEEP_DEPRECATED_PROPERTIES ;
184193
185194 /**
186195 * The encoding of the source CSS files to be used for reading the CSS file in
187196 * case neither a @charset rule nor a BOM is present.
188197 *
189- * @parameter property="sourceEncoding" default-value="UTF-8 "
198+ * @parameter property="sourceEncoding" default-value="ISO-8859-1 "
190199 */
191- private String sourceEncoding = StandardCharsets . UTF_8 .name ();
200+ private String sourceEncoding = CSSReaderSettings . DEFAULT_CHARSET .name ();
192201
193202 /**
194203 * The filename extension that should be used for the minified/compressed CSS
@@ -298,6 +307,11 @@ public void setBrowserCompliantMode (final boolean bBrowserCompliantMode)
298307 browserCompliantMode = bBrowserCompliantMode ;
299308 }
300309
310+ public void setKeepDeprecatedProperties (final boolean bKeepDeprecatedProperties )
311+ {
312+ keepDeprecatedProperties = bKeepDeprecatedProperties ;
313+ }
314+
301315 public void setSourceEncoding (final String sSourceEncoding )
302316 {
303317 // Throws an exception on an illegal charset
@@ -358,7 +372,8 @@ private void _compressCSSFile (@Nonnull final File aChild)
358372 {
359373 // Compress the file only if the compressed file is older than the original
360374 // file. Note: lastModified on a non-existing file returns 0L
361- final File aCompressed = new File (FilenameHelper .getWithoutExtension (aChild .getAbsolutePath ()) + targetFileExtension );
375+ final File aCompressed = new File (FilenameHelper .getWithoutExtension (aChild .getAbsolutePath ()) +
376+ targetFileExtension );
362377 if (aCompressed .lastModified () < aChild .lastModified () || forceCompress )
363378 {
364379 if (verbose )
@@ -372,7 +387,8 @@ private void _compressCSSFile (@Nonnull final File aChild)
372387 final CSSReaderSettings aSettings = new CSSReaderSettings ().setCSSVersion (ECSSVersion .CSS30 )
373388 .setFallbackCharset (aFallbackCharset )
374389 .setCustomExceptionHandler (aExHdl )
375- .setBrowserCompliantMode (browserCompliantMode );
390+ .setBrowserCompliantMode (browserCompliantMode )
391+ .setKeepDeprecatedProperties (keepDeprecatedProperties );
376392 final CascadingStyleSheet aCSS = CSSReader .readFromFile (aChild , aSettings );
377393 if (aCSS != null )
378394 {
@@ -423,7 +439,9 @@ private void _scanDirectory (@Nonnull final File aDir)
423439 _scanDirectory (aChild );
424440 }
425441 else
426- if (aChild .isFile () && CSSFilenameHelper .isCSSFilename (aChild .getName ()) && !_isAlreadyCompressed (aChild .getName ()))
442+ if (aChild .isFile () &&
443+ CSSFilenameHelper .isCSSFilename (aChild .getName ()) &&
444+ !_isAlreadyCompressed (aChild .getName ()))
427445 {
428446 // We're ready to rumble!
429447 _compressCSSFile (aChild );
0 commit comments