-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugin: Remove vendor script registration
- Loading branch information
Showing
1 changed file
with
4 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,21 +139,6 @@ function gutenberg_register_scripts_and_styles() { | |
global $wp_scripts; | ||
|
||
gutenberg_register_vendor_scripts(); | ||
|
||
wp_add_inline_script( | ||
'wp-polyfill', | ||
wp_get_script_polyfill( | ||
$wp_scripts, | ||
array( | ||
'\'fetch\' in window' => 'wp-polyfill-fetch', | ||
'document.contains' => 'wp-polyfill-node-contains', | ||
'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata', | ||
'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest', | ||
), | ||
'after' | ||
) | ||
); | ||
|
||
gutenberg_register_packages_scripts(); | ||
|
||
// Inline scripts. | ||
|
@@ -245,33 +230,6 @@ function gutenberg_register_scripts_and_styles() { | |
), | ||
'after' | ||
); | ||
wp_add_inline_script( | ||
'moment', | ||
sprintf( | ||
"moment.locale( '%s', %s );", | ||
get_user_locale(), | ||
wp_json_encode( | ||
array( | ||
'months' => array_values( $wp_locale->month ), | ||
'monthsShort' => array_values( $wp_locale->month_abbrev ), | ||
'weekdays' => array_values( $wp_locale->weekday ), | ||
'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ), | ||
'week' => array( | ||
'dow' => (int) get_option( 'start_of_week', 0 ), | ||
), | ||
'longDateFormat' => array( | ||
'LT' => get_option( 'time_format', __( 'g:i a', 'default' ) ), | ||
'LTS' => null, | ||
'L' => null, | ||
'LL' => get_option( 'date_format', __( 'F j, Y', 'default' ) ), | ||
'LLL' => __( 'F j, Y g:i a', 'default' ), | ||
'LLLL' => null, | ||
), | ||
) | ||
) | ||
), | ||
'after' | ||
); | ||
// Loading the old editor and its config to ensure the classic block works as expected. | ||
wp_add_inline_script( | ||
'editor', | ||
|
@@ -525,52 +483,10 @@ function gutenberg_preload_api_request( $memo, $path ) { | |
* @since 0.1.0 | ||
*/ | ||
function gutenberg_register_vendor_scripts() { | ||
$suffix = SCRIPT_DEBUG ? '' : '.min'; | ||
|
||
// Vendor Scripts. | ||
$react_suffix = ( SCRIPT_DEBUG ? '.development' : '.production' ) . $suffix; | ||
|
||
gutenberg_register_vendor_script( | ||
'react', | ||
'https://unpkg.com/[email protected]/umd/react' . $react_suffix . '.js', | ||
array( 'wp-polyfill' ) | ||
); | ||
gutenberg_register_vendor_script( | ||
'react-dom', | ||
'https://unpkg.com/[email protected]/umd/react-dom' . $react_suffix . '.js', | ||
array( 'react' ) | ||
); | ||
$moment_script = SCRIPT_DEBUG ? 'moment.js' : 'min/moment.min.js'; | ||
gutenberg_register_vendor_script( | ||
'moment', | ||
'https://unpkg.com/[email protected]/' . $moment_script, | ||
array() | ||
); | ||
gutenberg_register_vendor_script( | ||
'lodash', | ||
'https://unpkg.com/[email protected]/lodash' . $suffix . '.js' | ||
); | ||
wp_add_inline_script( 'lodash', 'window.lodash = _.noConflict();' ); | ||
gutenberg_register_vendor_script( | ||
'wp-polyfill-fetch', | ||
'https://unpkg.com/[email protected]/dist/fetch.umd.js' | ||
); | ||
gutenberg_register_vendor_script( | ||
'wp-polyfill-formdata', | ||
'https://unpkg.com/[email protected]/formdata.min.js' | ||
); | ||
gutenberg_register_vendor_script( | ||
'wp-polyfill-node-contains', | ||
'https://unpkg.com/[email protected]/polyfills/Node/prototype/contains/polyfill.js' | ||
); | ||
gutenberg_register_vendor_script( | ||
'wp-polyfill-element-closest', | ||
'https://unpkg.com/[email protected]/element-closest.js' | ||
); | ||
gutenberg_register_vendor_script( | ||
'wp-polyfill', | ||
'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.0.0/polyfill' . $suffix . '.js' | ||
); | ||
/* | ||
* This function is kept as an empty stub, in case Gutenberg should need to | ||
* explicitly provide a version newer than that provided by core. | ||
*/ | ||
} | ||
|
||
/** | ||
|