add editor-color-palette-bootstrap4.json

This commit is contained in:
IanDelMar 2022-11-22 02:06:22 +01:00
parent 93956282c2
commit b53188afd1
2 changed files with 7 additions and 1 deletions

View File

@ -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 );

View File

@ -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,
},
},
};