SCRIPT_DEBUG constant in WordPress

By default WordPress loads minified version of CSS and JS files so that it would contribute in loading time. As from the user point it is helpful but as for the developer point it might be sometime painful during development. Minified CSS and JS files are very hard to read and understand, so debugging becomes complicated in that case.
In such cases it would be very easy if we could see the unminifed versions of CSS and JS, isn’t it?
Yes, it would be very easy and WordPress have solutions for it.
It is SCRIPT_DEBUG constant.
Just put following line as you define constant WP_DEBUG in wp-config.php file.
define( ‘SCRIPT_DEBUG’, true );
After you put this line in wp-config.php and view page source then you can see the unminified version of the CSS and JS.
That’s a great start, but what about its use in plugin or theme?
Definitely there SCRIPT_DEBUG has its use in plugin or theme. Its better to have minified and unminifed version of CSS and JS in our plugin or theme. We can load our minified version of files using following method.

function your_plugin_scripts() {
	// if SCRIPT_DEBUG is undefined/ false, use minified libraries
	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
	// Load script.
	wp_enqueue_script( 'plugin-script-handle', plugin_dir_url( __FILE__ ) . 'assets/plugin-script-file' . $suffix . '.js', array( 'jquery' ) );
	// Load style.
	wp_enqueue_style( 'plugin-style-handle', plugin_dir_url( __FILE__ ) . 'assets/css/plugin-style-file' . $suffix . '.css', array() );
add_action( 'wp_enqueue_scripts', 'your_plugin_scripts' );

And this would load minified version of you files if SCRIPT_DEBUG is not defined or false.
Hope this small article would be some how helpful to you. Let me know your feedback.