-
-
Notifications
You must be signed in to change notification settings - Fork 193
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 "theme" and "custom" bundles. #4054
base: master
Are you sure you want to change the base?
Conversation
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 thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
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! |
# Allow bundles to have "theme" resp. "theme" and "custom" as dependency | ||
# so that bundles can be rendered after theme and custom resources. | ||
js_names += ["theme"] | ||
css_names += ["theme", "custom"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below in https://github.com/plone/Products.CMFPlone/pull/4054/files#diff-9e095767a08db89a248c84c46d31c75898eed2d7dc40b0757a835bb2af0ed95bR143 and https://github.com/plone/Products.CMFPlone/pull/4054/files#diff-9e095767a08db89a248c84c46d31c75898eed2d7dc40b0757a835bb2af0ed95bR165
If "theme" or "custom" does not exist (both added in line 192+) the bundle dependency cannot be resolved and the bundle is not included in the rendered output.
@jenkins-plone-org please run jobs |
This needs to be documented, but I'm not sure where. Perhaps in Theming of Classic UI? That section is so sad. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good enhancement. Anyway, this needs some documentation, since it is not obvious.
I think this should go into https://6.docs.plone.org/classic-ui/static-resources.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow I could not get this to work correctly. I checked out your branch and tested it with the plone-fullscreen
bundle:
- I added
custom
to depends, but the CSS was not added... also the.js
is missing (because custom is only defined for CSS but the bundle has JS also) - I added
theme
to depends and get the following traceback:
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 391, in publish_module
Module ZPublisher.WSGIPublisher, line 285, in publish
Module ZPublisher.mapply, line 98, in mapply
Module ZPublisher.WSGIPublisher, line 68, in call_object
Module zope.browserpage.simpleviewclass, line 44, in __call__
Module Products.Five.browser.pagetemplatefile, line 127, in __call__
Module Products.Five.browser.pagetemplatefile, line 59, in __call__
Module zope.pagetemplate.pagetemplate, line 134, in pt_render
Module Products.PageTemplates.engine, line 368, in __call__
Module z3c.pt.pagetemplate, line 198, in render
Module chameleon.zpt.template, line 328, in render
Module chameleon.template, line 229, in render
Module chameleon.utils, line 20, in raise_with_traceback
Module chameleon.template, line 200, in render
Module 1ac8f88237956af17a352f1fc406ccdd, line 1880, in render
Module 985090d925cc459bf0e69fde89f3e030, line 903, in render_master
Module 615bdf9739ecd0ffd4d4eee8b7a6ebd5, line 498, in render_master
Module zope.contentprovider.tales, line 76, in __call__
Module zope.viewlet.manager, line 157, in update
Module zope.viewlet.manager, line 163, in _updateViewlets
Module Products.CMFPlone.resources.browser.resource, line 260, in update
Module webresource._api, line 719, in render
Module webresource._api, line 678, in resolve
webresource._api.ResourceMissingDependencyError: webresource._api.ResourceMissingDependencyError: Resource defines missing dependency: <PloneScriptResource name="plone-fullscreen", depends="['theme']">
what am I missing here?
IMO custom should stay the last one. |
+1 I think that would be the expected behavior. If I change something TTW it should override everything else (without using |
I too agree |
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.