- if ( !count( $this->mArgs ) ) {
- $this->error( "minify.php: At least one input file must be specified." );
- exit( 1 );
- }
-
- if ( $this->hasOption( 'outfile' ) ) {
- if ( count( $this->mArgs ) > 1 ) {
- $this->error( '--outfile may only be used with a single input file.' );
- exit( 1 );
- }
-
- // Minify one file
- $this->minify( $this->getArg( 0 ), $this->getOption( 'outfile' ) );
-
- return;
- }
-
- $outDir = $this->getOption( 'outdir', false );
-
- foreach ( $this->mArgs as $arg ) {
- $inPath = realpath( $arg );
- $inName = basename( $inPath );
- $inDir = dirname( $inPath );
-
- if ( strpos( $inName, '.min.' ) !== false ) {
- $this->error( "Skipping $inName\n" );
- continue;
- }
-
- if ( !file_exists( $inPath ) ) {
- $this->error( "File does not exist: $arg", true );
+ $outputFile = $this->getOption( 'outfile', false );
+ if ( $outputFile === false ) {
+ // Only output the minified result (or errors)
+ // Avoid output() because this should not honour --quiet
+ foreach ( $this->mArgs as $arg ) {
+ print $this->minify( $arg ) . "\n";