summaryrefslogtreecommitdiff
blob: 09c64e0ab4b6ee2a765aa2bf3c6fbaeb50754a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

$path      = dirname( dirname( __FILE__ ) ) . '/';
$directory = new RecursiveDirectoryIterator( $path );
$iterator  = new RecursiveIteratorIterator( $directory );
$regex     = new RegexIterator( $iterator, '/^.+\.(css|js)$/i', RecursiveRegexIterator::GET_MATCH );

$manifest = array();
foreach ( $regex as $file => $value ) {
	$file = str_replace( $path, '', $file );
	$directory = substr( $file, 0, strpos( $file, '/' ) );
	if ( in_array( $directory, array( 'node_modules', 'tests' ) ) ) {
		continue;
	}
	$manifest[] = $file;
}

$export = var_export( $manifest, true );

file_put_contents( $path . 'modules/photon-cdn/jetpack-manifest.php', "<?php \r\n\$assets = $export;\r\n" );