Skip to:
Content

BuddyPress.org

Changeset 6264


Ignore:
Timestamp:
08/24/2012 06:10:17 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Switch to .min for compressed JS and CSS files.

  • This moves our "development" versions from .dev.js to .js (same for css).
  • The compressed version then moves from .js to .min.js (same for css).
  • By switching to the standard .min convention, it sets expectations for developers, and works nicely with existing tools such as ack.
  • Fixes #4455.
  • Props nacin.
Location:
trunk
Files:
8 edited
22 copied
14 moved

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-admin.php

    r6259 r6264  
    160160
    161161    // Decide whether to load the dev version of the CSS and JavaScript
    162     $dev = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'dev.' : '';
     162    $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : 'min.';
    163163
    164164    // Decide whether to load the index or edit screen
     
    245245
    246246    // Enqueue CSS and JavaScript
    247     wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . "bp-activity/admin/js/admin.{$dev}js",   array( 'jquery', 'wp-ajax-response' ), bp_get_version(), true );
    248     wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(),                               bp_get_version()       );
     247    wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . "bp-activity/admin/js/admin.{$min}js",   array( 'jquery', 'wp-ajax-response' ), bp_get_version(), true );
     248    wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$min}css", array(),                               bp_get_version()       );
    249249
    250250    // Handle spam/un-spam/delete of activities
     
    569569                <div id="poststuff">
    570570
    571                     <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 
     571                    <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
    572572                        <div id="post-body-content">
    573573                            <div id="postdiv" class="postarea">
  • trunk/bp-core/bp-core-admin.php

    r6159 r6264  
    404404    public function enqueue_scripts() {
    405405
    406         $maybe_dev = '';
    407         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
    408             $maybe_dev = '.dev';
    409 
    410         $file = $this->css_url . "common{$maybe_dev}.css";
     406        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     407
     408        $file = $this->css_url . "common{$min}.css";
    411409        $file = apply_filters( 'bp_core_admin_common_css', $file );
    412410        wp_enqueue_style( 'bp-admin-common-css', $file, array(), bp_get_version() );
     
    416414
    417415            // Styling
    418             $file = $this->css_url . "wizard{$maybe_dev}.css";
     416            $file = $this->css_url . "wizard{$min}.css";
    419417            $file = apply_filters( 'bp_core_admin_wizard_css', $file );
    420418            wp_enqueue_style( 'bp-admin-wizard-css', $file, array(), bp_get_version() );
    421419
    422420            // JS
    423             $file = $this->js_url . "wizard{$maybe_dev}.js";
     421            $file = $this->js_url . "wizard{$min}.js";
    424422            $file = apply_filters( 'bp_core_admin_wizard_js', $file );
    425423            wp_enqueue_script( 'bp-admin-wizard-js', $file, array(), bp_get_version() );
  • trunk/bp-core/bp-core-adminbar.php

    r5868 r6264  
    5050 */
    5151function bp_core_load_admin_bar_css() {
     52    global $wp_styles;
    5253
    5354    if ( ! bp_use_wp_admin_bar() || ! is_admin_bar_showing() )
    5455        return;
    5556
     57    $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     58
    5659    // Toolbar styles
    57     if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
    58         $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar.dev.css';
    59     else
    60         $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar.css';
     60    $stylesheet = BP_PLUGIN_URL . "bp-core/css/admin-bar{$min}.css";
    6161
    6262    wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', $stylesheet ), array( 'admin-bar' ), bp_get_version() );
    63 
    64     if ( !is_rtl() )
    65         return;
    66 
    67     if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
    68         $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar-rtl.dev.css';
    69     else
    70         $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar-rtl.css';
    71 
    72     wp_enqueue_style( 'bp-admin-bar-rtl', apply_filters( 'bp_core_admin_bar_rtl_css', $stylesheet ), array( 'bp-admin-bar' ), bp_get_version() );
     63    $wp_styles->add_data( 'bp-admin-bar', 'rtl', true );
     64    if ( $min )
     65        $wp_styles->add_data( 'bp-admin-bar', 'suffix', $min );
    7366}
    7467add_action( 'bp_init', 'bp_core_load_admin_bar_css' );
  • trunk/bp-core/bp-core-buddybar.php

    r6161 r6264  
    666666 */
    667667function bp_core_load_buddybar_css() {
     668    global $wp_styles;
     669
    668670    if ( bp_use_wp_admin_bar() || ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) || ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR ) )
    669671        return;
    670672
     673    $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     674
    671675    if ( file_exists( get_stylesheet_directory() . '/_inc/css/adminbar.css' ) ) // Backwards compatibility
    672676        $stylesheet = get_stylesheet_directory_uri() . '/_inc/css/adminbar.css';
    673     elseif ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
    674         $stylesheet = BP_PLUGIN_URL . 'bp-core/css/buddybar.dev.css';
    675677    else
    676         $stylesheet = BP_PLUGIN_URL . 'bp-core/css/buddybar.css';
    677 
    678     wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', $stylesheet ), array(), bp_get_version() );
    679 
    680     if ( !is_rtl() )
    681         return;
    682 
    683     if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
    684         $stylesheet = BP_PLUGIN_URL . 'bp-core/css/buddybar-rtl.dev.css';
    685     else
    686         $stylesheet = BP_PLUGIN_URL . 'bp-core/css/buddybar-rtl.css';
    687 
    688     wp_enqueue_style( 'bp-admin-bar-rtl', apply_filters( 'bp_core_buddybar_rtl_css', $stylesheet ), array( 'bp-admin-bar' ), bp_get_version() );
     678        $stylesheet = BP_PLUGIN_URL . "bp-core/css/buddybar{$min}.css";
     679
     680    wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_buddybar_rtl_css', $stylesheet ), array(), bp_get_version() );
     681    $wp_styles->add_data( 'bp-admin-bar', 'rtl', true );
     682    if ( $min )
     683        $wp_styles->add_data( 'bp-admin-bar', 'suffix', $min );
    689684}
    690685add_action( 'bp_init', 'bp_core_load_buddybar_css' );
  • trunk/bp-core/bp-core-widgets.php

    r6262 r6264  
    2020
    2121        if ( is_active_widget( false, false, $this->id_base ) && !is_admin() && !is_network_admin() ) {
    22             if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    23                 wp_enqueue_script( 'bp_core_widget_members-js', BP_PLUGIN_URL . 'bp-core/js/widget-members.dev.js', array( 'jquery' ), bp_get_version() );
    24             } else {
    25                 wp_enqueue_script( 'bp_core_widget_members-js', BP_PLUGIN_URL . 'bp-core/js/widget-members.js',     array( 'jquery' ), bp_get_version() );
    26             }
     22            $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     23            wp_enqueue_script( 'bp_core_widget_members-js', BP_PLUGIN_URL . "bp-core/js/widget-members{$min}.js", array( 'jquery' ), bp_get_version() );
    2724        }
    2825    }
  • trunk/bp-groups/bp-groups-widgets.php

    r6262 r6264  
    2929
    3030        if ( is_active_widget( false, false, $this->id_base ) && !is_admin() && !is_network_admin() ) {
    31             if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    32                 wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . 'bp-groups/js/widget-groups.dev.js', array( 'jquery' ), bp_get_version() );
    33             } else {
    34                 wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . 'bp-groups/js/widget-groups.js', array( 'jquery' ),     bp_get_version() );
    35             }
     31            $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     32            wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . "bp-groups/js/widget-groups{$min}.js", array( 'jquery' ), bp_get_version() );
    3633        }
    3734    }
     
    4946
    5047        echo $before_widget;
    51        
     48
    5249        $title = $instance['link_title'] ? '<a href="' . trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) . '">' . $instance['title'] . '</a>' : $instance['title'];
    53        
     50
    5451        echo $before_title
    5552           . $title
     
    106103    function update( $new_instance, $old_instance ) {
    107104        $instance = $old_instance;
    108        
     105
    109106        $instance['title']         = strip_tags( $new_instance['title'] );
    110107        $instance['max_groups']    = strip_tags( $new_instance['max_groups'] );
     
    131128
    132129        <p><label for="bp-groups-widget-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%" /></label></p>
    133        
     130
    134131        <p><label for="<?php echo $this->get_field_name('link_title') ?>"><input type="checkbox" name="<?php echo $this->get_field_name('link_title') ?>" value="1" <?php checked( $link_title ) ?> /> <?php _e( 'Link widget title to Groups directory', 'buddypress' ) ?></label></p>
    135132
  • trunk/bp-messages/bp-messages-cssjs.php

    r6011 r6264  
    1919        add_action( 'wp_head', 'messages_autocomplete_init_jsblock' );
    2020
    21         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    22             wp_enqueue_script( 'bp-jquery-autocomplete',    BP_PLUGIN_URL . 'bp-messages/js/autocomplete/jquery.autocomplete.dev.js',   array( 'jquery' ), bp_get_version() );
    23             wp_enqueue_script( 'bp-jquery-autocomplete-fb', BP_PLUGIN_URL . 'bp-messages/js/autocomplete/jquery.autocompletefb.dev.js', array(),           bp_get_version() );
    24             wp_enqueue_script( 'bp-jquery-bgiframe',        BP_PLUGIN_URL . 'bp-messages/js/autocomplete/jquery.bgiframe.dev.js',       array(),           bp_get_version() );
    25             wp_enqueue_script( 'bp-jquery-dimensions',      BP_PLUGIN_URL . 'bp-messages/js/autocomplete/jquery.dimensions.dev.js',     array(),           bp_get_version() );
    26 
    27         } else {
    28             wp_enqueue_script( 'bp-jquery-autocomplete',    BP_PLUGIN_URL . 'bp-messages/js/autocomplete/jquery.autocomplete.js',   array( 'jquery' ), bp_get_version() );
    29             wp_enqueue_script( 'bp-jquery-autocomplete-fb', BP_PLUGIN_URL . 'bp-messages/js/autocomplete/jquery.autocompletefb.js', array(),           bp_get_version() );
    30             wp_enqueue_script( 'bp-jquery-bgiframe',        BP_PLUGIN_URL . 'bp-messages/js/autocomplete/jquery.bgiframe.js',       array(),           bp_get_version() );
    31             wp_enqueue_script( 'bp-jquery-dimensions',      BP_PLUGIN_URL . 'bp-messages/js/autocomplete/jquery.dimensions.js',     array(),           bp_get_version() );
    32         }
     21        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     22        wp_enqueue_script( 'bp-jquery-autocomplete',    BP_PLUGIN_URL . "bp-messages/js/autocomplete/jquery.autocomplete{$min}.js",   array( 'jquery' ), bp_get_version() );
     23        wp_enqueue_script( 'bp-jquery-autocomplete-fb', BP_PLUGIN_URL . "bp-messages/js/autocomplete/jquery.autocompletefb{$min}.js", array(),           bp_get_version() );
     24        wp_enqueue_script( 'bp-jquery-bgiframe',        BP_PLUGIN_URL . "bp-messages/js/autocomplete/jquery.bgiframe{$min}.js",       array(),           bp_get_version() );
     25        wp_enqueue_script( 'bp-jquery-dimensions',      BP_PLUGIN_URL . "bp-messages/js/autocomplete/jquery.dimensions{$min}.js",     array(),           bp_get_version() );
    3326    }
    3427}
     
    3831
    3932    if ( bp_is_messages_component() && bp_is_current_action( 'compose' ) ) {
    40         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    41             wp_enqueue_style( 'bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.dev.css', array(), bp_get_version() );
    42         } else {
    43             wp_enqueue_style( 'bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.css',     array(), bp_get_version() );
    44         }
     33        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     34        wp_enqueue_style( 'bp-messages-autocomplete', BP_PLUGIN_URL . "bp-messages/css/autocomplete/jquery.autocompletefb{$min}.css", array(), bp_get_version() );
    4535
    4636        wp_print_styles();
  • trunk/bp-xprofile/bp-xprofile-cssjs.php

    r6259 r6264  
    1818function xprofile_add_admin_css() {
    1919    if ( !empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) {
    20         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    21             wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . 'bp-xprofile/admin/css/admin.dev.css', array(), bp_get_version() );
    22         } else {
    23             wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . 'bp-xprofile/admin/css/admin.css',     array(), bp_get_version() );
    24         }
     20        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     21        wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . "bp-xprofile/admin/css/admin{$min}.css", array(), bp_get_version() );
    2522    }
    2623}
     
    4138        wp_enqueue_script( 'jquery-ui-sortable'  );
    4239
    43         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    44             wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . 'bp-xprofile/admin/js/admin.dev.js', array( 'jquery', 'jquery-ui-sortable' ), bp_get_version() );
    45         } else {
    46             wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . 'bp-xprofile/admin/js/admin.js',     array( 'jquery', 'jquery-ui-sortable' ), bp_get_version() );
    47         }
     40        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     41        wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . "bp-xprofile/admin/js/admin{$min}.js", array( 'jquery', 'jquery-ui-sortable' ), bp_get_version() );
    4842    }
    4943}
Note: See TracChangeset for help on using the changeset viewer.