And we now have CSSMin
[lhc/web/wiklou.git] / maintenance / minify.php
index 6b94291..a5cca10 100644 (file)
@@ -48,13 +48,12 @@ class MinifyScript extends Maintenance {
                        $inDir = dirname( $inPath );
 
                        if ( strpos( $inName, '.min.' ) !== false ) {
-                               echo "Skipping $inName\n";
+                               $this->error( "Skipping $inName\n" );
                                continue;
                        }
 
                        if ( !file_exists( $inPath ) ) {
-                               $this->error( "File does not exist: $arg" );
-                               exit( 1 );
+                               $this->error( "File does not exist: $arg", true );
                        }
 
                        $extension = $this->getExtension( $inName );
@@ -80,7 +79,7 @@ class MinifyScript extends Maintenance {
 
        public function minify( $inPath, $outPath ) {
                $extension = $this->getExtension( $inPath );
-               echo basename( $inPath ) . ' -> ' . basename( $outPath ) . '...';
+               $this->output( basename( $inPath ) . ' -> ' . basename( $outPath ) . '...' );
 
                $inText = file_get_contents( $inPath );
                if ( $inText === false ) {
@@ -97,13 +96,16 @@ class MinifyScript extends Maintenance {
                        case 'js':
                                $outText = JSMin::minify( $inText );
                                break;
+                       case 'css':
+                               $outText = CSSMin::minify( $inText );
+                               break;
                        default:
                                $this->error( "No minifier defined for extension \"$extension\"" );
                }
 
                fwrite( $outFile, $outText );
                fclose( $outFile );
-               echo " ok\n";
+               $this->output( " ok\n" );
        }
 }