Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
7c61100d
Commit
7c61100d
authored
1 year ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Do the same for CSS.
parent
57f4f6ce
No related branches found
No related tags found
1 merge request
!7360
Draft: Add an extra page to the test.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/lib/Drupal/Core/Asset/AssetResolver.php
+7
-3
7 additions, 3 deletions
core/lib/Drupal/Core/Asset/AssetResolver.php
with
7 additions
and
3 deletions
core/lib/Drupal/Core/Asset/AssetResolver.php
+
7
−
3
View file @
7c61100d
...
...
@@ -143,10 +143,10 @@ public function getCssAssets(AttachedAssetsInterface $assets, $optimize, Languag
'preprocess'
=>
TRUE
,
];
foreach
(
$libraries_to_load
as
$library
)
{
foreach
(
$libraries_to_load
as
$key
=>
$library
)
{
[
$extension
,
$name
]
=
explode
(
'/'
,
$library
,
2
);
$definition
=
$this
->
libraryDiscovery
->
getLibraryByName
(
$extension
,
$name
);
if
(
isset
(
$definition
[
'css'
]))
{
if
(
!
empty
(
$definition
[
'css'
]))
{
foreach
(
$definition
[
'css'
]
as
$options
)
{
$options
+=
$default_options
;
// Copy the asset library license information to each file.
...
...
@@ -165,6 +165,9 @@ public function getCssAssets(AttachedAssetsInterface $assets, $optimize, Languag
$css
[
$options
[
'data'
]]
=
$options
;
}
}
else
{
unset
(
$libraries_to_load
[
$key
]);
}
}
// Allow modules and themes to alter the CSS assets.
...
...
@@ -176,7 +179,7 @@ public function getCssAssets(AttachedAssetsInterface $assets, $optimize, Languag
uasort
(
$css
,
[
static
::
class
,
'sort'
]);
if
(
$optimize
)
{
$css
=
\Drupal
::
service
(
'asset.css.collection_optimizer'
)
->
optimize
(
$css
,
$libraries_to_load
,
$language
);
$css
=
\Drupal
::
service
(
'asset.css.collection_optimizer'
)
->
optimize
(
$css
,
array_values
(
$libraries_to_load
)
,
$language
);
}
}
$this
->
cache
->
set
(
$cid
,
$css
,
CacheBackendInterface
::
CACHE_PERMANENT
,
[
'library_info'
]);
...
...
@@ -253,6 +256,7 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize, Language
unset
(
$libraries_to_load
[
$key
]);
}
}
$libraries_to_load
=
array_values
(
$libraries_to_load
);
// The current list of header JS libraries are only those libraries that
// are in the header, but their dependencies must also be loaded for them
// to function correctly, so update the list with those.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment