private void process ( File file ) throws WatchingException { getLog ( ) . info ( "Minifying CSS files from " + file . getName ( ) + " using Clean CSS" ) ; File filtered = getFilteredVersion ( file ) ; if ( filtered == null ) { filtered = file ; } File output = getMinifiedFile ( file ) ; if ( output . exists ( ) ) { FileUtils . deleteQuietly ( output ) ; } if ( ! output . getParentFile ( ) . isDirectory ( ) ) { getLog ( ) . debug ( "Creating output directory for " + output . getAbsolutePath ( ) + " : " + output . getParentFile ( ) . mkdirs ( ) ) ; } getLog ( ) . info ( "Minifying " + filtered . getAbsolutePath ( ) + " to " + output . getAbsolutePath ( ) ) ; try { List < String > arguments = new ArrayList <> ( ) ; arguments . add ( "--output" ) ; arguments . add ( output . getAbsolutePath ( ) ) ; arguments . add ( "--source-map" ) ; if ( cleanCssArguments != null ) { arguments . addAll ( Splitter . on ( ' ' ) . splitToList ( cleanCssArguments ) ) ; } // Input file: arguments . add ( filtered . getAbsolutePath ( ) ) ; int exit = cleancss . execute ( "cleancss" , arguments . toArray ( new String [ arguments . size ( ) ] ) ) ; getLog ( ) . debug ( "CSS minification execution exiting with " + exit + " status" ) ; } catch ( MojoExecutionException e ) { throw new WatchingException ( "Error during the minification of " + filtered . getName ( ) , e ) ; } }
Minifies the CSS file using Clean CSS .