-
Notifications
You must be signed in to change notification settings - Fork 279
Description
Hi there,
The components' CSS classes carry a version prefix to ensure peaceful coexistence of multiple different versions in the same frontend.
For example, the internal CSS class
--_ui5_side_navigation_width
is compiled to
--_ui5-v1-24-26_side_navigation_width
In SAC, we reference quite a couple of these classes. This means that whenever we update the UI5WC packages, we need to revisit all of them and update the prefix.
I have tried to automate this by constructing the prefix like so:
import versionInfo from '@ui5/webcomponents-base/dist/generated/VersionInfo';
const cssClass = `var(--ui5-v${versionInfo.major}-${versionInfo.minor}-${versionInfo.patch}_side_navigation_width`;However, VersionInfo is exported by the base package. Does this mean that the resulting version will be that of the base package, which might or might not correspond to the version of the main and fiori packages that define the CSS classes? And if this approach doesn't work, is there a recommended way that would spare us the pain of having to do this manually on each upgrade?
This issue has appeared on our radar because we are currently in the process of updating from 1.24.24 to 1.24.26 and there is some confusion around which version prefix to use:
Intuitively, we have added _26, which doesn't work. By looking into the compiled code, we can see that the prefix for .26 is _25:
- Open package
- Go to
dist/css/themes/SideNavigation.css - [CTRL] + [F] ->
_side_navigation_width
Edit:
A solution to this problem could be for you to export your CSS classes as an enum, which means we wouldn't have to deal with the prefixes at all anymore.
Similarly to how the react package handles this with ThemingParameters.
I understand this would require some refactorings, including setting up CSS modules if you don't currently use them, so I don't know how feasible this would be.
Can you shed some light on this?
Thanks!