Making WordPress.org

Changeset 7428


Ignore:
Timestamp:
07/11/2018 09:05:30 PM (6 years ago)
Author:
obenland
Message:

WPorg: Use compressed scripts.

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

Legend:

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

    r6277 r7428  
    3939            files: [ 'Gruntfile.js', 'js/**/*.js' ],
    4040            options: grunt.file.readJSON( '.jshintrc' )
     41        },
     42        uglify: {
     43            options: {
     44                ASCIIOnly: true,
     45                screwIE8: false
     46            },
     47            js: {
     48                expand: true,
     49                cwd: 'js/',
     50                dest: 'js/',
     51                ext: '.min.js',
     52                src: '**/*.js',
     53            }
    4154        },
    4255        sass: {
     
    157170    grunt.loadNpmTasks( 'grunt-contrib-watch' );
    158171    grunt.loadNpmTasks( 'grunt-contrib-jshint' );
     172    grunt.loadNpmTasks( 'grunt-contrib-uglify' );
    159173
    160174    grunt.registerTask( 'css', ['sass_globbing', 'sass', 'postcss', 'rtlcss:dynamic'] );
    161175    grunt.registerTask( 'default', ['jshint', 'css'] );
    162     grunt.registerTask( 'build', ['css'] );
     176    grunt.registerTask( 'build', ['css', 'uglify:js'] );
    163177};
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/functions.php

    r7358 r7428  
    100100 */
    101101function scripts() {
     102    $script_debug = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
     103    $suffix       = $script_debug ? '' : '.min';
     104
     105    // Concatenates core scripts when possible.
     106    if ( ! $script_debug ) {
     107        $GLOBALS['concatenate_scripts'] = true;
     108    }
     109
    102110    wp_enqueue_style( 'wporg-style', get_theme_file_uri( '/css/style.css' ), [ 'dashicons', 'open-sans' ], '20180702' );
    103111    wp_style_add_data( 'wporg-style', 'rtl', 'replace' );
    104112
    105113    // phpcs:ignore Squiz.PHP.CommentedOutCode.Found, Squiz.Commenting.InlineComment.InvalidEndChar
    106     // wp_enqueue_script( 'wporg-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
    107     wp_enqueue_script( 'wporg-plugins-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
     114    // wp_enqueue_script( 'wporg-navigation', get_template_directory_uri() . "/js/navigation$suffix.js", array(), '20151215', true );
     115    wp_enqueue_script( 'wporg-plugins-skip-link-focus-fix', get_template_directory_uri() . "/js/skip-link-focus-fix$suffix.js", array(), '20151215', true );
    108116
    109117    if ( ! is_front_page() && is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
Note: See TracChangeset for help on using the changeset viewer.