My colleagues and I are trying to adapt some of the add-ons that we developed for Plone 4.1 to migrate our Plone environment to Plone 5 this year. At the same time, we had problems trying to adapt our code to the new resource registry policies. After examining what happened for a while, we decided to test the add-on with minimal code in the Plone environment to find out if we were going to do something wrong.
The file structure in this add-on is as follows:
- my.package
- my
- package
- profiles
- default
- metadata.xml
- registry.xml
- uninstall
- registry.xml
- static
- css
- style.less
- __init__.py
- configure.zcml
- __init__.py
- my.package.egg-info
- setup.cfg
- setup.py
The contents of my.package.configure.zcml are as follows:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup">
<five:registerPackage package="." initialize=".initialize" />
<plone:static
directory="static"
type="plone"
name="my.package" />
<genericsetup:registerProfile
name="default"
title="my.package"
directory="profiles/default"
description="Installs my.package"
provides="Products.GenericSetup.interfaces.EXTENSION" />
<genericsetup:registerProfile
name="uninstall"
title="my.package"
directory="profiles/uninstall"
description="Uninstalls my.package"
provides="Products.GenericSetup.interfaces.EXTENSION" />
</configure>
The contents of my.package.profiles.registry.xml are as follows:
<registry>
<records prefix="plone.resources/my-package"
interface='Products.CMFPlone.interfaces.IResourceRegistry'>
<value key="css">
<element>++plone++my.package/css/style.less</element>
</value>
</records>
<records prefix="plone.bundles/my-package"
interface='Products.CMFPlone.interfaces.IBundleRegistry'>
<value key="resources">
<element>my-package</element>
</value>
<value key="enabled">True</value>
<value key="compile">True</value>
<value key="merge_with">logged-in</value>
</records>
</registry>
The contents of my.package.static.css.style.less are as follows:
.icon-controlpanel-resourceregistries:before { color: red; }
, (, , ).
, , , LESS. ( LESS : , , , @@overview-controlpanel).
http://docs.plone.org/adapt-and-extend/theming/resourceregistry.html, , , .
" ". , , , ( , plone.bundles/my-package.csscompilation None ++ plone ++ static/my-package-compiled. CSS).
, , , logged-in.css, @@overview-controlpanel , .
Product.CMFPlone, , , , logged-in.css merge_with , csscompilation, (. Product.CMFPlone.resources.browser.combine.write_css).
, merge_with, csscompilation None, , .
, :
- Build Build, , plone.bundles/my-package.csscompilation . , . , Merge bundles , , ( - ?). BrowserView, , .
, , logged-in.css, , plone.bundles/my -package.csscompilation None.
Products.CMFPlone, , Products.CMFPlone.controlpanel.browser.resourceregistry.ResourceRegistryControlPanelView # save_registry,
self.update_registry_collection(
IBundleRegistry, "plone.bundles",
json.loads(req.get('bundles')))
, None .
Plone 5.0.6, Plone 5.1a2. .
, , , , - .
, CSS LESS csscompilation Generic Setup.
, , LESS, LESS plone logged-in.css( . css ).
, - Products.CMFPlone, , . !