Prompt user to set SCRIPT_DEBUG on WP 5 for now.
This commit is contained in:
parent
e933427d5a
commit
a5b1b617c2
|
@ -14,6 +14,10 @@ This is a feature plugin for a modern, javascript-driven WooCommerce Admin exper
|
||||||
|
|
||||||
For better debugging, it's also recommended you add `define( 'SCRIPT_DEBUG', true );` to your wp-config. This will load the unminified version of all libraries, and specifically the development build of React.
|
For better debugging, it's also recommended you add `define( 'SCRIPT_DEBUG', true );` to your wp-config. This will load the unminified version of all libraries, and specifically the development build of React.
|
||||||
|
|
||||||
|
### WordPress 5
|
||||||
|
|
||||||
|
There is an unresolved bug ( https://github.com/woocommerce/wc-admin/issues/796 ) that prevents us from running with minified script. Until this is resolved, include `define( 'SCRIPT_DEBUG', true );` in your wp-config.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
After cloning the repo, install dependencies with `npm install`. Now you can build the files using one of these commands:
|
After cloning the repo, install dependencies with `npm install`. Now you can build the files using one of these commands:
|
||||||
|
|
|
@ -28,12 +28,25 @@ if ( ! defined( 'WC_ADMIN_PLUGIN_FILE' ) ) {
|
||||||
* Notify users of the plugin requirements
|
* Notify users of the plugin requirements
|
||||||
*/
|
*/
|
||||||
function wc_admin_plugins_notice() {
|
function wc_admin_plugins_notice() {
|
||||||
$message = sprintf(
|
// The notice varies by WordPress version.
|
||||||
/* translators: 1: URL of Gutenberg plugin, 2: URL of WooCommerce plugin */
|
$wordpress_version = get_bloginfo( 'version' );
|
||||||
__( 'The WooCommerce Admin feature plugin requires both <a href="%1$s">Gutenberg</a> and <a href="%2$s">WooCommerce</a> (>3.5) to be installed and active.', 'wc-admin' ),
|
$wordpress_includes_gutenberg = version_compare( $wordpress_version, '4.9.9', '>' );
|
||||||
'https://wordpress.org/plugins/gutenberg/',
|
|
||||||
'https://wordpress.org/plugins/woocommerce/'
|
if ( $wordpress_includes_gutenberg ) {
|
||||||
);
|
$message = sprintf(
|
||||||
|
// TODO: Remove the "and SCRIPT_DEBUG enabled" when https://github.com/woocommerce/wc-admin/issues/796 is fixed.
|
||||||
|
/* translators: URL of WooCommerce plugin */
|
||||||
|
__( 'The WooCommerce Admin feature plugin requires <a href="%s">WooCommerce</a> (>3.5) to be installed and active and SCRIPT_DEBUG enabled.', 'wc-admin' ),
|
||||||
|
'https://wordpress.org/plugins/woocommerce/'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$message = sprintf(
|
||||||
|
/* translators: 1: URL of Gutenberg plugin, 2: URL of WooCommerce plugin */
|
||||||
|
__( 'The WooCommerce Admin feature plugin requires both <a href="%1$s">Gutenberg</a> and <a href="%2$s">WooCommerce</a> (>3.5) to be installed and active.', 'wc-admin' ),
|
||||||
|
'https://wordpress.org/plugins/gutenberg/',
|
||||||
|
'https://wordpress.org/plugins/woocommerce/'
|
||||||
|
);
|
||||||
|
}
|
||||||
printf( '<div class="error"><p>%s</p></div>', $message ); /* WPCS: xss ok. */
|
printf( '<div class="error"><p>%s</p></div>', $message ); /* WPCS: xss ok. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +65,11 @@ function dependencies_satisfied() {
|
||||||
$wordpress_includes_gutenberg = version_compare( $wordpress_version, '4.9.9', '>' );
|
$wordpress_includes_gutenberg = version_compare( $wordpress_version, '4.9.9', '>' );
|
||||||
$gutenberg_plugin_active = defined( 'GUTENBERG_DEVELOPMENT_MODE' ) || defined( 'GUTENBERG_VERSION' );
|
$gutenberg_plugin_active = defined( 'GUTENBERG_DEVELOPMENT_MODE' ) || defined( 'GUTENBERG_VERSION' );
|
||||||
|
|
||||||
return $wordpress_includes_gutenberg || $gutenberg_plugin_active;
|
// Right now, there is a bug preventing us from running with WP5 with minified script.
|
||||||
|
// See https://github.com/woocommerce/wc-admin/issues/796 for details.
|
||||||
|
$script_debug_enabled = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
|
||||||
|
|
||||||
|
return ( $script_debug_enabled && $wordpress_includes_gutenberg ) || $gutenberg_plugin_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue