Changeset 50838 for trunk/src/wp-includes/script-loader.php
- Timestamp:
- 05/11/2021 04:26:28 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/script-loader.php
r50837 r50838 1366 1366 1367 1367 /** 1368 * Checks whether separate assets should be loaded for core blocks.1369 *1370 * @since 5.81371 *1372 * @return bool1373 */1374 function should_load_separate_core_block_assets() {1375 if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {1376 return false;1377 }1378 /**1379 * Determine if separate styles & scripts will be loaded for blocks on-render or not.1380 *1381 * @since 5.8.01382 *1383 * @param bool $load_separate_styles Whether separate styles will be loaded or not.1384 *1385 * @return bool Whether separate styles will be loaded or not.1386 */1387 return apply_filters( 'separate_core_block_assets', false );1388 }1389 1390 /**1391 1368 * Assign default styles to $styles object. 1392 1369 * … … 2277 2254 * @since 5.6.0 2278 2255 * 2279 * @return bool 2256 * @return bool Whether scripts and styles should be enqueued. 2280 2257 */ 2281 2258 function wp_should_load_block_editor_scripts_and_styles() { … … 2285 2262 2286 2263 /** 2287 * Filters the flag that decides whether or not block editor scripts and 2288 * stylesare going to be enqueued on the current screen.2264 * Filters the flag that decides whether or not block editor scripts and styles 2265 * are going to be enqueued on the current screen. 2289 2266 * 2290 2267 * @since 5.6.0 … … 2293 2270 */ 2294 2271 return apply_filters( 'should_load_block_editor_scripts_and_styles', $is_block_editor_screen ); 2272 } 2273 2274 /** 2275 * Checks whether separate assets should be loaded for core blocks on-render. 2276 * 2277 * @since 5.8.0 2278 * 2279 * @return bool Whether separate assets will be loaded or not. 2280 */ 2281 function should_load_separate_core_block_assets() { 2282 if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { 2283 return false; 2284 } 2285 2286 /** 2287 * Filters the flag that decides whether or not separate scripts and styles 2288 * will be loaded for core blocks on-render or not. 2289 * 2290 * @since 5.8.0 2291 * 2292 * @param bool $load_separate_assets Whether separate assets will be loaded or not. 2293 * Default false. 2294 */ 2295 return apply_filters( 'separate_core_block_assets', false ); 2295 2296 } 2296 2297 … … 2530 2531 2531 2532 /** 2532 * Allow small styles to be inlined. 2533 * This improves performance and sustainability, and is opt-in. 2534 * 2535 * Stylesheets can opt-in by adding `path` data using `wp_style_add_data`, and defining the file's absolute path. 2536 * wp_style_add_data( $style_handle, 'path', $file_path ); 2533 * Allows small styles to be inlined. 2534 * 2535 * This improves performance and sustainability, and is opt-in. Stylesheets can opt in 2536 * by adding `path` data using `wp_style_add_data`, and defining the file's absolute path: 2537 * 2538 * wp_style_add_data( $style_handle, 'path', $file_path ); 2537 2539 * 2538 2540 * @since 5.8.0 2539 2541 * 2540 * @ return void2542 * @global WP_Styles $wp_styles 2541 2543 */ 2542 2544 function wp_maybe_inline_styles() { 2545 global $wp_styles; 2543 2546 2544 2547 $total_inline_limit = 20000; … … 2547 2550 * 2548 2551 * @param int $total_inline_limit The file-size threshold, in bytes. Defaults to 20000. 2549 * @return int The file-size threshold, in bytes.2550 2552 */ 2551 2553 $total_inline_limit = apply_filters( 'styles_inline_size_limit', $total_inline_limit ); 2552 2554 2553 global $wp_styles;2554 2555 $styles = array(); 2555 2556 … … 2574 2575 ); 2575 2576 2576 /* *2577 /* 2577 2578 * The total inlined size. 2578 2579 *
Note: See TracChangeset
for help on using the changeset viewer.