core/core.libraries.yml | 10 +++++----- core/lib/Drupal/Core/Asset/AssetResolver.php | 8 ++++---- core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php | 4 ++-- .../system/tests/modules/ajax_test/ajax_test.libraries.yml | 2 +- .../system/tests/modules/common_test/common_test.libraries.yml | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/core.libraries.yml b/core/core.libraries.yml index 621b173..5a4aecb 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -44,7 +44,7 @@ domready: drupal: # Block the page from being loaded until the 'js' class is added to . - critical: true + critical_path: true version: VERSION js: misc/drupal.js: { weight: -18 } @@ -182,7 +182,7 @@ drupal.displace: drupal.dropbutton: # Block the page from being loaded until dropbuttons are initialized. - critical: true + critical_path: true version: VERSION js: misc/dropbutton/dropbutton.js: {} @@ -314,7 +314,7 @@ drupal.vertical-tabs: html5shiv: # Block the page from being loaded until html5shiv is initialized. - critical: true + critical_path: true remote: https://github.com/aFarkas/html5shiv version: 3.7.2 license: @@ -815,7 +815,7 @@ matchmedia.addListener: modernizr: # Block the page from being loaded until Modernizr is initialized. - critical: true + critical_path: true remote: https://github.com/Modernizr/Modernizr license: name: MIT @@ -838,7 +838,7 @@ normalize: picturefill: # Block the page from being loaded until picturefill is initialized. - critical: true + critical_path: true remote: https://github.com/scottjehl/picturefill # @todo Contribute upstream and/or replace with upstream version. # @see https://drupal.org/node/1775530 diff --git a/core/lib/Drupal/Core/Asset/AssetResolver.php b/core/lib/Drupal/Core/Asset/AssetResolver.php index 2db246f..47a33c3 100644 --- a/core/lib/Drupal/Core/Asset/AssetResolver.php +++ b/core/lib/Drupal/Core/Asset/AssetResolver.php @@ -216,18 +216,18 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize) { $javascript = []; $libraries_to_load = $this->getLibrariesToLoad($assets); - // Collect all libraries that contain JS assets and are critical. + // Collect all libraries that contain JS assets and are i/t critical path. $header_js_libraries = []; foreach ($libraries_to_load as $library) { list($extension, $name) = explode('/', $library, 2); $definition = $this->libraryDiscovery->getLibraryByName($extension, $name); - if (isset($definition['js']) && isset($definition['critical']) && $definition['critical']) { + if (isset($definition['js']) && isset($definition['critical_path']) && $definition['critical_path']) { $header_js_libraries[] = $library; } } // The current list of header JS libraries are only those libraries that are - // critical, but their dependencies must also be loaded for them to function - // correctly, so update the list with those. + // in the critical path, but their dependencies must also be loaded for them + // to function correctly, so update the list with those. $header_js_libraries = $this->libraryDependencyResolver->getLibrariesWithDependencies($header_js_libraries); foreach ($libraries_to_load as $library) { diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php index 404496a..3215b66 100644 --- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php @@ -86,8 +86,8 @@ public function buildByExtension($extension) { } $library += array('dependencies' => array(), 'js' => array(), 'css' => array()); - if (isset($library['critical']) && !is_bool($library['critical'])) { - throw new \LogicException(sprintf("The 'critical' key in the library definition '%s' in extension '%s' is invalid: it must be a boolean.", $id, $extension)); + if (isset($library['critical_path']) && !is_bool($library['critical_path'])) { + throw new \LogicException(sprintf("The 'critical_path' key in the library definition '%s' in extension '%s' is invalid: it must be a boolean.", $id, $extension)); } if (isset($library['version'])) { diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.libraries.yml b/core/modules/system/tests/modules/ajax_test/ajax_test.libraries.yml index 33a52bc..2db897a 100644 --- a/core/modules/system/tests/modules/ajax_test/ajax_test.libraries.yml +++ b/core/modules/system/tests/modules/ajax_test/ajax_test.libraries.yml @@ -18,6 +18,6 @@ order-footer-js-command: footer.js: {} order-header-js-command: - critical: true + critical_path: true js: header.js: {} diff --git a/core/modules/system/tests/modules/common_test/common_test.libraries.yml b/core/modules/system/tests/modules/common_test/common_test.libraries.yml index b9c5179..2a05318 100644 --- a/core/modules/system/tests/modules/common_test/common_test.libraries.yml +++ b/core/modules/system/tests/modules/common_test/common_test.libraries.yml @@ -37,7 +37,7 @@ js-attributes: defer: true js-header: - critical: true + critical_path: true js: header.js: {} dependencies: