Making WordPress.org

Changeset 1467


Ignore:
Timestamp:
04/01/2015 12:59:30 AM (10 years ago)
Author:
obenland
Message:

WP.org Themes: Further optimize the Directory's load time.

This will cut down on the amount of requests for core-bundled JS resources, and
half the size of JS app. I thought about minifying style.css as well but
decided to hold off on that for now. Savings are not very big and it'll
probably be more confusing than helpful.

With the project switching to maintenance mode, we can now also set a saneer
version string.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php

    r1449 r1467  
    3838 */
    3939function wporg_themes_scripts() {
    40     wp_enqueue_style( 'wporg-themes', get_stylesheet_uri(), array(), filemtime( __DIR__ . '/style.css' ) );
     40    $script_debug = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
     41    $suffix       = $script_debug ? '' : '.min';
     42
     43    // Concatenates core scripts when possible.
     44    if ( ! $script_debug ) {
     45        $GLOBALS['concatenate_scripts'] = true;
     46    }
     47
     48    wp_enqueue_style( 'wporg-themes', get_stylesheet_uri(), array(), '1' );
    4149
    4250    if ( ! is_singular( 'page' ) ) {
    4351        wp_enqueue_script( 'google-jsapi', '//www.google.com/jsapi', array( 'jquery' ), null, true );
    44         wp_enqueue_script( 'wporg-theme', get_template_directory_uri() . '/js/theme.js', array( 'wp-backbone' ), filemtime( __DIR__ . '/js/theme.js' ), true );
     52        wp_enqueue_script( 'wporg-theme', get_template_directory_uri() . "/js/theme{$suffix}.js", array( 'wp-backbone' ), '1', true );
    4553
    4654        wp_localize_script( 'wporg-theme', '_wpThemeSettings', array(
     
    6674
    6775    // No emoji support needed.
    68     remove_action( 'wp_print_styles','print_emoji_styles' );
    69     wp_dequeue_script( 'emoji' );
     76    remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
     77    remove_action( 'wp_print_styles', 'print_emoji_styles' );
    7078
    7179    // No Jetpack styles needed.
Note: See TracChangeset for help on using the changeset viewer.