summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/bin/build-asset-cdn-json.php')
-rw-r--r--plugins/jetpack/bin/build-asset-cdn-json.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/jetpack/bin/build-asset-cdn-json.php b/plugins/jetpack/bin/build-asset-cdn-json.php
new file mode 100644
index 00000000..09c64e0a
--- /dev/null
+++ b/plugins/jetpack/bin/build-asset-cdn-json.php
@@ -0,0 +1,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" );