PluginProbe
Gutenberg / 22.4.3
Gutenberg v22.4.3
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / modules.php

modules.php in Gutenberg 22.4.3, at build/modules.php

47 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Script module registration - Auto-generated by build process.
4 * Do not edit this file manually.
5 *
6 * @package gutenberg
7 */
8
9 if ( ! function_exists( 'gutenberg_register_script_modules' ) ) {
10 /**
11 * Register all script modules.
12 */
13 function gutenberg_register_script_modules() {
14 // Load build constants
15 $build_constants = require __DIR__ . '/constants.php';
16 $modules_dir = __DIR__ . '/modules';
17 $modules_file = $modules_dir . '/registry.php';
18
19 if ( ! file_exists( $modules_file ) ) {
20 return;
21 }
22
23 $modules = require $modules_file;
24 $base_url = $build_constants['build_url'] . 'modules/';
25 $extension = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js';
26
27 foreach ( $modules as $module ) {
28 $asset_path = $modules_dir . '/' . $module['asset'];
29 $asset = file_exists( $asset_path ) ? require $asset_path : array();
30
31 wp_register_script_module(
32 $module['id'],
33 $base_url . $module['path'] . $extension,
34 $asset['module_dependencies'] ?? array(),
35 $asset['version'] ?? false,
36 array(
37 'fetchpriority' => 'low',
38 'in_footer' => true,
39 )
40 );
41 }
42 }
43
44 add_action( 'wp_default_scripts', 'gutenberg_register_script_modules' );
45 remove_action( 'wp_default_scripts', 'wp_default_script_modules' );
46 }
47