From 785db37bd2866d369757e072000ffc19973121d2 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 3 Dec 2024 20:01:27 -0800 Subject: [PATCH 1/7] Document how to specify a static resource bundle to load as the last one in Classic UI --- docs/classic-ui/static-resources.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/classic-ui/static-resources.md b/docs/classic-ui/static-resources.md index 84a8aec56..002c307eb 100644 --- a/docs/classic-ui/static-resources.md +++ b/docs/classic-ui/static-resources.md @@ -52,7 +52,7 @@ You can register a CSS resource in the same way. ``` -Registering a JavaScript file and a CSS file in the same bundle is also possible. +You can also register a JavaScript file and a CSS file in the same bundle. ```xml @@ -100,4 +100,20 @@ The following attributes are available for registering a static resource: ## Loading order of resources -`depends` is used to define the loading order of resources by specifying the name of the depending bundle. +You can use the `depends` attribute to define the order in which resources load. + +You can specify a list of either the names of the bundles on which this bundle depends or a single list item of `["all"]`. +In the latter case of `["all"]` for a bundle, all other JavaScript and CSS resources in their resource groups will render before this bundle, making it the final bundle to render in its resource group. +This includes the theme, such as Barceloneta's theme CSS. + +This feature lets you override a theme with custom CSS from a bundle. +Previously you had to add the CSS customizations to the registry via the `custom_css` settings, then update the registry after every change. + +```{versionadded} Plone 6.0.14 +The `depends` attribute may be assigned the value of `["all"]`, making this bundle render last, after all other bundles. +``` + +```{note} +Setting `depends=["all"]` does not affect custom CSS that you define in the {guilabel}`Theming` control panel, which _always_ renders as the last style resource. +It only affects bundles, not control panel settings. +``` From 77770c35eff72b5ad405ac5bfb3c73d8b597491c Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 4 Dec 2024 05:44:07 -0800 Subject: [PATCH 2/7] Merge content from #1803 --- docs/classic-ui/static-resources.md | 65 ++++++++++++++++++----------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/docs/classic-ui/static-resources.md b/docs/classic-ui/static-resources.md index 002c307eb..ccfa9f24f 100644 --- a/docs/classic-ui/static-resources.md +++ b/docs/classic-ui/static-resources.md @@ -12,7 +12,11 @@ myst: # Static resources We often want to ship a website with a static resource, such as an image, icon, CSS, or JavaScript file. -For this, we need to register static resources. +For CSS and JavaScript files, we can use the resource registry to register, then deliver, them to the client browser. + +The resource registry provides a programmatic way, either in code or through the web, to extend and configure the dependencies between static resources. +It also automatically manages caching of static resources. +If you were to hard-code these resources in templates with `` or `