Saved as a php file in the mu-plugins folder each part must exsist in the styles folder:
<?php
function combine_json_files( $input_files = array(), $output_path ) {
$contents = [];
foreach ( $input_files as $input_file ) {
$contents = array_replace_recursive( $contents, json_decode( file_get_contents( $input_file ), true ) );
}
file_put_contents( $output_path, json_encode( $contents ) );
}
combine_json_files(
[
get_theme_file_path( 'styles/settings.json' ),
get_theme_file_path( 'styles/colours.json' ),
get_theme_file_path( 'styles/templates.json' ),
get_theme_file_path( 'styles/styles.json' ),
],
get_theme_file_path( 'theme.json' )
);
<?php
function combine_json_files( $input_files = array(), $output_path ) {
$contents = [];
foreach ( $input_files as $input_file ) {
$contents = array_replace_recursive( $contents, json_decode( file_get_contents( $input_file ), true ) );
}
file_put_contents( $output_path, json_encode( $contents ) );
}
combine_json_files(
[
get_theme_file_path( 'styles/settings.json' ),
get_theme_file_path( 'styles/colours.json' ),
get_theme_file_path( 'styles/templates.json' ),
get_theme_file_path( 'styles/styles.json' ),
],
get_theme_file_path( 'theme.json' )
);