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

TASK: Define runtime CSS variables for plugins #3438

Merged
merged 2 commits into from
Mar 31, 2023

Conversation

mhsdesign
Copy link
Member

@mhsdesign mhsdesign commented Mar 21, 2023

closes: #3431
closes: #3422

Hi, sorry yes i know this is confusing.

This file currently is not the actual source of the used css variables in the UI, as we have packages/build-essentials/src/styles/styleConstants.js
So why do i say currently? can i look into the future? As a matter of fact yes.
We are currently in the Neos Ui branch 7.3 8.0 8.1 or 8.2,
beginning with Neos 8.3 we will start to use this file here as actual source of truth (see #3366)

So you are still wondering why we introduced it into 7.3? Let me explain...
In the 7.3 to 8.2 time the webpack neos-ui-extensibility plugin bundler actually replaces all the css variables as into the bundled plugincode,
but starting with Neos 8.3 the webpack adapter doesnt do this anymore (because of overhead) and also because this would require that we have a separate esbuild extensibility plugin to do the same.
As you might now we dont even have an esbuild plugin, you can just rely on the alias map of the neos-ui-extensibility and might even be able to use it in rollup of webpack5.
So to provide an easy migration, we expose the css variables as real runtime variables, that way they can also be consumed as such.
The reason we backported the runtime variables to Neos 7.3 is to reduce overhead for plugin authors, so they can use the new 8.3 extensibility bundlers but their plugins are compatible with Neos 7.3 too

What I did

How I did it

How to verify it

@mhsdesign
Copy link
Member Author

see slack discussion: https://neos-project.slack.com/archives/C0U0KEGDQ/p1678005415642609

and @Sebobo and me also talked about this and we agreed upon this solution

@mhsdesign
Copy link
Member Author

mhsdesign commented Mar 24, 2023

For older instances like 5.3 you can easily make it compatible with newer plugins, which depend on the runtime css variables by including the css variables in your stylecheets neosui yaml config

Settings.yaml

Neos:
  Neos:
    Ui:
      resources:
        stylesheets:
          'HotFix.CssVariables':
            resource: resource://Vendor.Site/Public/cssVariables.css

cssVariables.css

copy the contents of https://github.com/neos/neos-ui/blob/e4080d6bb1a14a2c5eb843109ee82af38b84c8cf/cssVariables.css

@crydotsnake crydotsnake changed the title Task: #3431 Runtime Css Variables For Plugins TASK: #3431 Runtime Css Variables For Plugins Mar 24, 2023
@Sebobo Sebobo changed the title TASK: #3431 Runtime Css Variables For Plugins TASK: Runtime CSS variables for plugins Mar 30, 2023
@Sebobo Sebobo changed the title TASK: Runtime CSS variables for plugins TASK: Define runtime CSS variables for plugins Mar 30, 2023
cssVariables.css Outdated Show resolved Hide resolved
@mhsdesign mhsdesign requested a review from Sebobo March 30, 2023 17:20
Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

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

@mhsdesign with the lowercase thing I actually mentioned the hex color values, not the variable names. It just looks a bit sloppy right now. Even though it was like that before.

But beside that fine by reading.

@mhsdesign
Copy link
Member Author

mhsdesign commented Mar 31, 2023

ahh i see, but i indeed meant the casing too ^^ (also that way people are bit more scared to use it and they should be :P )

lets just say its not our prettiest api

@mhsdesign mhsdesign merged commit 67fe0f0 into 7.3 Mar 31, 2023
@mhsdesign mhsdesign deleted the task/3431-runtime-css-variables-for-plugins branch March 31, 2023 07:09
@mhsdesign mhsdesign mentioned this pull request Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants