Skip to:
Content

BuddyPress.org

Changeset 8772


Ignore:
Timestamp:
08/09/2014 04:22:03 PM (12 years ago)
Author:
djpaul
Message:

Core: make sure we load minified JS and CSS when SCRIPT_DEBUG is set.

Fixes #5615

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-cssjs.php

    r8770 r8772  
    1616 */
    1717function bp_core_register_common_scripts() {
    18         $ext = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js';
     18        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    1919        $url = buddypress()->plugin_url . 'bp-core/js/';
    2020       
    … …  
    2222
    2323                // Legacy
    24                 'bp-confirm'        => array( 'file' => "{$url}confirm{$ext}",        'dependencies' => array( 'jquery' ) ),
    25                 'bp-widget-members' => array( 'file' => "{$url}widget-members{$ext}", 'dependencies' => array( 'jquery' ) ),
    26                 'bp-jquery-query'   => array( 'file' => "{$url}jquery-query{$ext}",   'dependencies' => array( 'jquery' ) ),
    27                 'bp-jquery-cookie'  => array( 'file' => "{$url}jquery-cookie{$ext}",  'dependencies' => array( 'jquery' ) ),
     24                'bp-confirm'        => array( 'file' => "{$url}confirm{$min}.js",        'dependencies' => array( 'jquery' ) ),
     25                'bp-widget-members' => array( 'file' => "{$url}widget-members{$min}.js", 'dependencies' => array( 'jquery' ) ),
     26                'bp-jquery-query'   => array( 'file' => "{$url}jquery-query{$min}.js",   'dependencies' => array( 'jquery' ) ),
     27                'bp-jquery-cookie'  => array( 'file' => "{$url}jquery-cookie{$min}.js",  'dependencies' => array( 'jquery' ) ),
    2828
    2929                // 2.1
    30                 'jquery-caret' => array( 'file' => "{$url}jquery.caret{$ext}", 'dependencies' => array( 'jquery' ) ),
    31                 'jquery-atwho' => array( 'file' => "{$url}jquery.atwho{$ext}", 'dependencies' => array( 'jquery', 'jquery-caret' ) ),
     30                'jquery-caret' => array( 'file' => "{$url}jquery.caret{$min}.js", 'dependencies' => array( 'jquery' ) ),
     31                'jquery-atwho' => array( 'file' => "{$url}jquery.atwho{$min}.js", 'dependencies' => array( 'jquery', 'jquery-caret' ) ),
    3232        ) );
    3333
  • trunk/src/bp-core/deprecated/2.1.php

    r8770 r8772  
    1717 */
    1818function bp_core_register_deprecated_scripts() {
    19         $ext = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js';
     19        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    2020        $url = buddypress()->plugin_url . 'bp-core/deprecated/js/';
    2121
    2222        $scripts = apply_filters( 'bp_core_register_deprecated_scripts', array(
     23
    2324                // Core
    24                 'bp-jquery-scroll-to' => 'jquery-scroll-to',
     25                'bp-jquery-scroll-to' => array(
     26                        'file'         => "{$url}jquery-scroll-to{$min}.js",
     27                        'dependencies' => array( 'jquery' ),
     28                ),
    2529
    2630                // Messages
    27                 'bp-jquery-autocomplete'    => 'autocomplete/jquery.autocomplete',
    28                 'bp-jquery-autocomplete-fb' => 'autocomplete/jquery.autocompletefb',
    29                 'bp-jquery-bgiframe'        => 'autocomplete/jquery.bgiframe',
    30                 'bp-jquery-dimensions'      => 'autocomplete/jquery.dimensions',
     31                'bp-jquery-autocomplete'    => array(
     32                        'file'          => "{$url}autocomplete/jquery.autocomplete{$min}.js",
     33                        'dependencies' => array( 'jquery' ),
     34                ),
     35
     36                'bp-jquery-autocomplete-fb' => array(
     37                        'file'         => "{$url}autocomplete/jquery.autocompletefb{$min}.js",
     38                        'dependencies' => array( 'jquery' ),
     39                ),
     40
     41                'bp-jquery-bgiframe' => array(
     42                        'file'         => "{$url}autocomplete/jquery.bgiframe{$min}.js",
     43                        'dependencies' => array( 'jquery' ),
     44                ),
     45
     46                'bp-jquery-dimensions' => array(
     47                        'file'         => "{$url}autocomplete/jquery.dimensions{$min}.js",
     48                        'dependencies' => array( 'jquery' ),
     49                ),
    3150        ) );
    3251
    33         foreach ( $scripts as $id => $file ) {
    34                 wp_register_script( $id, $url . $file . $ext, array( 'jquery' ), bp_get_version(), true );
     52        foreach ( $scripts as $id => $script ) {
     53                wp_register_script( $id, $script['file'], $script['dependencies'], bp_get_version(), true );
    3554        }
    3655}
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r8770 r8772  
    203203
    204204                // Locate the BP stylesheet
    205                 $asset = $this->locate_asset_in_stack( 'buddypress.css', 'css' );
     205                $asset = $this->locate_asset_in_stack( "buddypress{$min}.css", 'css' );
    206206
    207207                // Enqueue BuddyPress-specific styling, if found
    … …  
    222222         */
    223223        public function enqueue_scripts() {
    224 
    225                 $file = 'buddypress.js';
     224                $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    226225
    227226                // Locate the BP JS file
    228                 $asset = $this->locate_asset_in_stack( $file, 'js' );
     227                $asset = $this->locate_asset_in_stack( "buddypress{$min}.js", 'js' );
    229228
    230229                // Enqueue the global JS, if found - AJAX will not work
    … …  
    260259                // Maybe enqueue password verify JS (register page or user settings page)
    261260                if ( bp_is_register_page() || ( function_exists( 'bp_is_user_settings_general' ) && bp_is_user_settings_general() ) ) {
    262                         $min      = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    263                         $filename = "password-verify{$min}.js";
    264261
    265262                        // Locate the Register Page JS file
    266                         $asset = $this->locate_asset_in_stack( $filename, 'js' );
    267 
    268                         // Enqueue script
     263                        $asset = $this->locate_asset_in_stack( "password-verify{$min}.js", 'js' );
     264
    269265                        $dependencies = array_merge( bp_core_get_js_dependencies(), array(
    270266                                'password-strength-meter',
    271267                        ) );
     268
     269                        // Enqueue script
    272270                        wp_enqueue_script( $asset['handle'] . '-password-verify', $asset['location'], $dependencies, $this->version);
    273271                }
Note: See TracChangeset for help on using the changeset viewer.