Created
March 12, 2011 16:19
-
-
Save emad-elsaid/867340 to your computer and use it in GitHub Desktop.
this script i put it beside the dojo and dijit directories, i used it to remove new lines from javascript files in all the dojo project, recursively
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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