Make WordPress Core

Changeset 44314 for trunk


Ignore:
Timestamp:
12/18/2018 11:24:07 PM (8 years ago)
Author:
desrosj
Message:

Script Loader: Pass the suffix to package style handles to ensure correct file names for minified RTL stylesheets.

Props ocean90.

Merges [44231] into trunk.

See #45547.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-includes/script-loader.php

    r44308 r44314  
    19221922        $styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6
    19231923
     1924        // Packages styles
     1925        $fonts_url = '';
     1926
     1927        /*
     1928         * Translators: Use this to specify the proper Google Font name and variants
     1929         * to load that is supported by your language. Do not translate.
     1930         * Set to 'off' to disable loading.
     1931         */
     1932        $font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' );
     1933        if ( 'off' !== $font_family ) {
     1934                $fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family );
     1935        }
     1936        $styles->add( 'wp-editor-font', $fonts_url );
     1937
     1938        $styles->add( 'wp-block-library-theme', "/wp-includes/css/dist/block-library/theme$suffix.css" );
     1939
     1940        $styles->add(
     1941                'wp-edit-blocks',
     1942                "/wp-includes/css/dist/block-library/editor$suffix.css",
     1943                array(
     1944                        'wp-components',
     1945                        'wp-editor',
     1946                        'wp-block-library',
     1947                        // Always include visual styles so the editor never appears broken.
     1948                        'wp-block-library-theme',
     1949                )
     1950        );
     1951
     1952        $package_styles = array(
     1953                'block-library'        => array(),
     1954                'components'           => array(),
     1955                'edit-post'            => array( 'wp-components', 'wp-editor', 'wp-edit-blocks', 'wp-block-library', 'wp-nux' ),
     1956                'editor'               => array( 'wp-components', 'wp-editor-font', 'wp-nux' ),
     1957                'format-library'       => array(),
     1958                'list-reusable-blocks' => array( 'wp-components' ),
     1959                'nux'                  => array( 'wp-components' ),
     1960        );
     1961
     1962        foreach ( $package_styles as $package => $dependencies ) {
     1963                $handle = 'wp-' . $package;
     1964                $path   = "/wp-includes/css/dist/$package/style$suffix.css";
     1965
     1966                $styles->add( $handle, $path, $dependencies );
     1967        }
     1968
    19241969        // RTL CSS
    19251970        $rtl_styles = array(
    1926                 // wp-admin
     1971                // Admin CSS
    19271972                'common',
    19281973                'forms',
     
    19471992                'ie',
    19481993                'login',
    1949                 // wp-includes
     1994                // Includes CSS
    19501995                'buttons',
    19511996                'admin-bar',
     
    19552000                'wp-pointer',
    19562001                'wp-jquery-ui-dialog',
    1957                 // deprecated
     2002                // Package styles
     2003                'wp-block-library-theme',
     2004                'wp-edit-blocks',
     2005                'wp-block-library',
     2006                'wp-components',
     2007                'wp-edit-post',
     2008                'wp-editor',
     2009                'wp-format-library',
     2010                'wp-list-reusable-blocks',
     2011                'wp-nux',
     2012                // Deprecated CSS
    19582013                'deprecated-media',
    19592014                'farbtastic',
     
    19652020                        $styles->add_data( $rtl_style, 'suffix', $suffix );
    19662021                }
    1967         }
    1968 
    1969         // Packages styles
    1970         $fonts_url = '';
    1971 
    1972         /*
    1973          * Translators: Use this to specify the proper Google Font name and variants
    1974          * to load that is supported by your language. Do not translate.
    1975          * Set to 'off' to disable loading.
    1976          */
    1977         $font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' );
    1978         if ( 'off' !== $font_family ) {
    1979                 $fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family );
    1980         }
    1981         $styles->add( 'wp-editor-font', $fonts_url );
    1982 
    1983         $styles->add( 'wp-block-library-theme', "/wp-includes/css/dist/block-library/theme$suffix.css" );
    1984         $styles->add_data( 'wp-block-library-theme', 'rtl', 'replace' );
    1985 
    1986         $styles->add(
    1987                 'wp-edit-blocks',
    1988                 "/wp-includes/css/dist/block-library/editor$suffix.css",
    1989                 array(
    1990                         'wp-components',
    1991                         'wp-editor',
    1992                         'wp-block-library',
    1993                         // Always include visual styles so the editor never appears broken.
    1994                         'wp-block-library-theme',
    1995                 )
    1996         );
    1997         $styles->add_data( 'wp-edit-blocks', 'rtl', 'replace' );
    1998 
    1999         $package_styles = array(
    2000                 'block-library'        => array(),
    2001                 'components'           => array(),
    2002                 'edit-post'            => array( 'wp-components', 'wp-editor', 'wp-edit-blocks', 'wp-block-library', 'wp-nux' ),
    2003                 'editor'               => array( 'wp-components', 'wp-editor-font', 'wp-nux' ),
    2004                 'format-library'       => array(),
    2005                 'list-reusable-blocks' => array( 'wp-components' ),
    2006                 'nux'                  => array( 'wp-components' ),
    2007         );
    2008 
    2009         foreach ( $package_styles as $package => $dependencies ) {
    2010                 $handle = 'wp-' . $package;
    2011                 $path   = "/wp-includes/css/dist/$package/style$suffix.css";
    2012 
    2013                 $styles->add( $handle, $path, $dependencies );
    2014                 $styles->add_data( $handle, 'rtl', 'replace' );
    20152022        }
    20162023}
Note: See TracChangeset for help on using the changeset viewer.