diff --git a/inc/block-editor.php b/inc/block-editor.php index e6a22eed..dc1fed41 100644 --- a/inc/block-editor.php +++ b/inc/block-editor.php @@ -43,7 +43,11 @@ if ( ! function_exists( 'understrap_generate_color_palette' ) ) { $color_palette = array(); // Grabs the autogenerated color palette that we're pulling from our compiled bootstrap stylesheets. - $color_palette_json = file_get_contents( get_theme_file_path( '/inc/editor-color-palette.json' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents + $file_path = get_theme_file_path( '/inc/editor-color-palette.json' ); + if ( 'bootstrap4' === get_theme_mod( 'understrap_bootstrap_version', 'bootstrap4' ) ) { + $file_path = get_theme_file_path( '/inc/editor-color-palette-bootstrap4.json' ); + } + $color_palette_json = file_get_contents( $file_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents if ( $color_palette_json ) { $color_palette_json = json_decode( $color_palette_json, true ); diff --git a/src/build/postcss.config.js b/src/build/postcss.config.js index ccdbe513..f20d8f85 100644 --- a/src/build/postcss.config.js +++ b/src/build/postcss.config.js @@ -20,6 +20,7 @@ const colors = [ const BS4 = process.argv[ process.argv.length - 1 ] === 'BS4'; const colorInfix = BS4 ? '' : 'bs-'; +const output = 'inc/editor-color-palette' + ( BS4 ? '-bootstrap4' : '' ) + '.json'; module.exports = ( ctx ) => { return { @@ -35,6 +36,7 @@ module.exports = ( ctx ) => { }, 'postcss-understrap-palette-generator': { colors: colors.map( ( x ) => `--${ colorInfix }${ x }` ), + output: output, }, }, };