Skip to content

Commit 0a6f097

Browse files
committed
Enqueue minified when not SCRIPT_DEBUG.
1 parent 1b22583 commit 0a6f097

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/ableplayer.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
* Text Domain: ableplayer
1616
* License: MIT
1717
* License URI: https://github.com/ableplayer/ableplayer-wordpress/blob/master/LICENSE
18-
* Version: 2.0.0
18+
* Version: 2.0.0-beta1
1919
*/
2020

2121
// Configure debugging mode.
2222
define( 'ABLEPLAYER_DEBUG', false );
2323

2424
// Get current version number.
25-
define( 'ABLEPLAYER_VERSION', '2.0.0' );
25+
define( 'ABLEPLAYER_VERSION', '2.0.0-beta1' );
2626

2727
require_once plugin_dir_path( __FILE__ ) . 'inc/settings.php';
2828
require_once plugin_dir_path( __FILE__ ) . 'inc/generator.php';
@@ -54,7 +54,8 @@ function ableplayer_enqueue_scripts() {
5454
wp_enqueue_script( 'js-cookie', plugins_url( 'thirdparty', __FILE__ ) . '/js.cookie.js', array( 'jquery' ), $version, true );
5555
wp_enqueue_script( 'vimeo', 'https://player.vimeo.com/api/player.js', array(), $version, true );
5656
wp_enqueue_style( 'ableplayer-video', plugins_url( 'assets', __FILE__ ) . '/css/media.css', array(), $version );
57-
wp_register_script( 'ableplayer-video', plugins_url( 'assets', __FILE__ ) . '/js/media.js', array(), $version, true );
57+
$media_js = ( SCRIPT_DEBUG ) ? 'media.js' : 'media.min.js';
58+
wp_register_script( 'ableplayer-video', plugins_url( 'assets', __FILE__ ) . '/js/' . $media_js, array(), $version, true );
5859
wp_localize_script(
5960
'ableplayer-video',
6061
'ableplayer',
@@ -111,9 +112,10 @@ function ableplayer_enqueue_scripts() {
111112
* Enqueue admin JS and CSS.
112113
*/
113114
function ableplayer_admin_scripts() {
114-
$version = ABLEPLAYER_VERSION;
115-
$version = ( SCRIPT_DEBUG ) ? $version . '-' . wp_rand( 1000, 9999 ) : $version;
116-
wp_enqueue_script( 'ableplayer-js', plugins_url( '/assets/js/admin.js', __FILE__ ), array( 'jquery', 'wp-a11y', 'clipboard' ), $version, true );
115+
$version = ABLEPLAYER_VERSION;
116+
$version = ( SCRIPT_DEBUG ) ? $version . '-' . wp_rand( 1000, 9999 ) : $version;
117+
$admin_js = ( SCRIPT_DEBUG ) ? 'admin.js' : 'admin.min.js';
118+
wp_enqueue_script( 'ableplayer-js', plugins_url( '/assets/js/' . $admin_js, __FILE__ ), array( 'jquery', 'wp-a11y', 'clipboard' ), $version, true );
117119
wp_localize_script(
118120
'ableplayer-js',
119121
'ableplayer',

0 commit comments

Comments
 (0)