Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bundles to be rendered after all other. #4074

Closed
wants to merge 2 commits into from

Conversation

thet
Copy link
Member

@thet thet commented Dec 3, 2024

This is the Plone 6.0 backport of: #4054

JS and CSS resources can now be rendered after all other resources in their
resource group including the theme (e.g. the Barceloneta theme CSS).

There is a exception for custom CSS which can be defined in the theming
controlpanel. This one is always rendered as last style resource.

To render a resource after all other give it the "depends" value of "all". This
indicates that the resource depends on all other being rendered before. The
resource is then rendered as last resource of it's resource group.

This allows to override a theme with custom CSS from a bundle instead of having
to add the CSS customizations to the registry via the "custom_css" settings.
As a consequence, theme customization can now be done in the filesystem in
ordinary CSS files instead of being bound to a time consuming workflow which
involces upgrading the custom_css registry after every change.

Docs

plone/documentation#1802
plone/documentation#1803

@mister-roboto
Copy link

@thet thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@thet thet force-pushed the thet-bundle-after-theme--60 branch from 82364cf to fb10af8 Compare December 3, 2024 16:42
@thet
Copy link
Member Author

thet commented Dec 3, 2024

@jenkins-plone-org please run jobs

Bundles can now depend on the automatically added "theme" and "custom" bundles
from plone.app.theming and be rendered after those (e.g. after the
plonetheme.barceloneta CSS).

This allows to override a theme with custom CSS from a bundle instead of having
to add the CSS customizations to the registry via the "custom_css" settings.
As a consequence, theme customization can now be done in the filesystem in
ordinary CSS files instead of being bound to a time consuming workflow which
involces upgrading the registry after every change.
@thet thet force-pushed the thet-bundle-after-theme--60 branch from fb10af8 to 0a5fe7e Compare December 3, 2024 21:17
@thet
Copy link
Member Author

thet commented Dec 3, 2024

@jenkins-plone-org please run jobs

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisions to mention multiple bundles with "all", and some grammar and spelling.

@@ -107,7 +107,9 @@ def check_dependencies(bundle_name, depends, bundles):
valid_dependencies = []

for name in depend_names:
if name in bundles:
if name in bundles or name == "all":
# A valid dependency or special dependency "all", which
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# A valid dependency or special dependency "all", which
# A valid dependency or a special dependency "all",

if name in bundles:
if name in bundles or name == "all":
# A valid dependency or special dependency "all", which
# specifies that the bundle should be rendered last.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# specifies that the bundle should be rendered last.
# meaning that all other bundles should render before these,
# making them the last to render.
# Multiple bundles with "all" will render in the order
# in which you declare them.

@@ -0,0 +1,17 @@
Allow bundles to be rendered after all other.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Allow bundles to be rendered after all other.
Allow bundles to be rendered after all others.

JS and CSS resources can now be rendered after all other resources in their
resource group including the theme (e.g. the Barceloneta theme CSS).

There is a exception for custom CSS which can be defined in the theming
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
There is a exception for custom CSS which can be defined in the theming
There is an exception for custom CSS which can be defined in the theming

There is a exception for custom CSS which can be defined in the theming
controlpanel. This one is always rendered as last style resource.

To render a resource after all other give it the "depends" value of "all". This
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To render a resource after all other give it the "depends" value of "all". This
To render resources after all others, give them the "depends" value of "all".

controlpanel. This one is always rendered as last style resource.

To render a resource after all other give it the "depends" value of "all". This
indicates that the resource depends on all other being rendered before. The
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
indicates that the resource depends on all other being rendered before. The
For each of these resources, "all" indicates that the resource depends on all other resources, making it render after its dependencies.


To render a resource after all other give it the "depends" value of "all". This
indicates that the resource depends on all other being rendered before. The
resource is then rendered as last resource of it's resource group.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resource is then rendered as last resource of it's resource group.
If you set multiple resources with "all", then they will render in the order in which you declare them.

indicates that the resource depends on all other being rendered before. The
resource is then rendered as last resource of it's resource group.

This allows to override a theme with custom CSS from a bundle instead of having
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This allows to override a theme with custom CSS from a bundle instead of having
This lets you override a theme with custom CSS from a bundle instead of having

@petschki
Copy link
Member

petschki commented Dec 6, 2024

Close this in favor of #4077

@petschki petschki closed this Dec 6, 2024
@thet thet deleted the thet-bundle-after-theme--60 branch December 6, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants