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

FEATURE: Reduced stylesheet for backend modules #2874

Merged
merged 3 commits into from
Apr 3, 2020

Conversation

Sebobo
Copy link
Member

@Sebobo Sebobo commented Jan 22, 2020

The old stylesheets from pre-react times override a lot of basic styles for backend modules.
This makes it hard to implement custom styles there or use our react ui components.

With this change it's possible to configure a "Lite" and a "Minimal" variant of the Neos backend stylesheet via the module configuration.

The old "Main" stylesheet variant is kept for compatibility reasons.

The "Lite" stylesheet should be used with almost all modules and will also be used for the core modules. It also provides all relevant Neos CSS variables and is about 50% smaller than the old one.

The "Minimal" stylesheet should be used for modules that bring their own styles. For example modules that use the Neos react-components library. It also provides all relevant Neos CSS variables and is about 70% smaller than the old one.

Example:

  Neos:
    modules:
      management: # Or any other module group
        submodules:
          myModule:
            controller: \My\Site\Controller\MyModuleController
            label: 'My module'
            description: 'My module'
            icon: 'fas fa-camera'
            privilegeTarget: 'My.Site:ManageMyModule'
            mainStylesheet: 'Lite' # Or 'Minimal', default is 'Main'

@Sebobo
Copy link
Member Author

Sebobo commented Jan 22, 2020

@skurfuerst this worked easier than expected as @markusguenther already did some work for Neos 5.1.
With the styles in the NeosLite.scss the backend modules looked fine so far. I haven't check everything in detail. But I'm also sure that more things can be removed or be moved outside the .neos prefix.

@skurfuerst
Copy link
Member

That looks awesome <3 :)

@Sebobo
Copy link
Member Author

Sebobo commented Mar 6, 2020

We should also think about providing the css variables from the Neos UI here and use them.

@Sebobo Sebobo force-pushed the feature/reduced-stylesheet branch from bca9351 to 43a1d2a Compare March 9, 2020 14:28
@Sebobo Sebobo marked this pull request as ready for review March 9, 2020 14:29
@Sebobo Sebobo added the Feature label Mar 9, 2020
@Sebobo Sebobo changed the title WIP FEATURE: Reduced stylesheet for backend modules FEATURE: Reduced stylesheet for backend modules Mar 9, 2020
@Sebobo
Copy link
Member Author

Sebobo commented Mar 9, 2020

So this is now working.
You can configure the style variant for each submodule individually.

It's not a very awesome solution but it helps. With Neos 6 we could throw the old stuff away and only keep the "NeosLite" variant.

I targeted it now for master as it's a feature, but we can discuss if we target 4.3 to make the backend modules work better as a bugfix.

@Sebobo Sebobo requested a review from kitsunet March 9, 2020 14:41
@Sebobo
Copy link
Member Author

Sebobo commented Mar 10, 2020

Instead of the resource path to the stylesheet I could also use a flag. Then it might be easier when deprecating the option.

@albe
Copy link
Member

albe commented Mar 18, 2020

Can't say if it is viable for 4.3 as I don't know how "breaky" this could be. But I'd at least like to get it into 5.2.

@Sebobo
Copy link
Member Author

Sebobo commented Mar 18, 2020

@skurfuerst do you still need this for the ACL package?

If not I would target 5.2.

@albe we will not have real breakiness as it would be a new config option and all old modules use the old stylesheet. I can start using the new one in 5.2 for our own modules. Then we already see if it worked out correctly.

@skurfuerst
Copy link
Member

@Sebobo thanks for pushing this forward. For the ACL package I have a workaround, but if I could get rid of that it would of course be nice.

IMHO the risk of breakage for 4.3 is almost 0, so I would be fine with 4.3 as Target as well. What do you think? :)
All the best sebastian

@Sebobo
Copy link
Member Author

Sebobo commented Mar 19, 2020

Ok, I will make some more changes and retarget. And another PR to adapt modules for 5.2

Fun fact: I found a discussion from 4 years ago about this issue in Slack :D

@skurfuerst
Copy link
Member

awesome @Sebobo :) Thanks for pushing this further!!

@albe
Copy link
Member

albe commented Apr 1, 2020

@Sebobo are you still up to retargeting this and creating another PR for 5.2?

@Sebobo
Copy link
Member Author

Sebobo commented Apr 2, 2020

@albe I won't be able to do both I think. Because the code of 4.x is a bit different in those places which I need to change.

Therefore I would now try to finish this one up and get it merged because I need it for the Media UI.

@albe
Copy link
Member

albe commented Apr 3, 2020

Suggestion: I'll merge this this evening and branch off 5.2, then you can fix up anything left to clean this up in the next two weeks until release :)

@Sebobo
Copy link
Member Author

Sebobo commented Apr 3, 2020

🏃

@Sebobo Sebobo force-pushed the feature/reduced-stylesheet branch from 43a1d2a to 42b3dc6 Compare April 3, 2020 15:23
With this change you can tell Neos to load a reduced
stylesheet for your backend module that will provide the necessary styles and resets for backend modules that use Neos styles but had issues with the old „Full“ styles and resets. This stylesheet is also only about 50% of the old one.

You can switch to the reduced stylesheet in your configuration like this:
```
Neos:
  Neos:
    modules:
      user: # Or any other module group
        submodules:
          myModule:
            mainStylesheet: Lite
```
With this change you can tell Neos to load a minimal
stylesheet for your backend module that will provide only the necessary styles and resets for the top bar, module navigation and footer bar.

You can switch to the minimal stylesheet in your configuration like this:
```
Neos:
  Neos:
    modules:
      user: # Or any other module group
        submodules:
          myModule:
            mainStylesheet: Minimal
```
@Sebobo Sebobo force-pushed the feature/reduced-stylesheet branch from 42b3dc6 to 5b88578 Compare April 3, 2020 15:27
@Sebobo
Copy link
Member Author

Sebobo commented Apr 3, 2020

@albe READY!

@albe
Copy link
Member

albe commented Apr 3, 2020

That wasn't supposed to give you some stress 😅 Thanks a lot!

@albe albe merged commit 1e88993 into neos:master Apr 3, 2020
@Sebobo Sebobo deleted the feature/reduced-stylesheet branch April 3, 2020 20:01
Sebobo added a commit to Sebobo/neos-development-collection that referenced this pull request Jun 8, 2020
They got lost in the style split for 5.2 in neos#2874
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants