Skip to content

Instantly share code, notes, and snippets.

@parhammmm
Forked from emad-elsaid/dojo optimizer.php
Created March 12, 2011 16:24
Show Gist options
  • Save parhammmm/867342 to your computer and use it in GitHub Desktop.
Save parhammmm/867342 to your computer and use it in GitHub Desktop.
<?php
function explore( $path ){
$files = scandir( $path );
$files = array_slice( $files, 2);
foreach( $files as $file )
if( is_dir( $path.'/'.$file ) )
explore( $path.'/'.$file );
else
process( $path.'/'.$file );
}
function process( $file ){
if( substr( $file, strlen($file)-3 )=='.js' )
{
echo $file."\n";
$text = file_get_contents( $file );
$text = str_replace( array("\r\n", "\n", "\r"), "", $text );
file_put_contents( $file, $text );
}
}
// directories to process
explore('dojo');
explore('dijit');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment