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

CSS files are not bundled for self-contained build (multiple CSS files are loaded for each library) #359

Open
1 of 6 tasks
kristian opened this issue Oct 15, 2018 · 4 comments
Labels
enhancement New feature or request module/ui5-builder Related to the UI5 Builder module

Comments

@kristian
Copy link
Member

Expected Behavior

One CSS file for the whole self-contained build should be loaded, based on the theme selected.

Current Behavior

Multiple CSS files (per library) are loaded separately by the browser, causing some performance degragation.

Steps to reproduce the issue

  1. Build & serve the sample app self-contained
  2. Check network trace to see, that more than one CSS file is loaded

Context

  • OS/Platform: Windows
  • Node.js Version: 10.11.0
  • npm Version: 6.4.1
  • Browser (if relevant): Chrome Dev.
  • Other information: Tested on 1.59.0

Affected components

@BenReim
Copy link

BenReim commented Apr 22, 2020

CSS bundling might not only be helpful in terms of performance, but also in regards to enabling caching mechanisms.

Currently its seems as that there is no straight-forward way of caching and invalidating resources files with a self-contained build. With a self-contained build, the core resource files can not be invalidated using a cachebuster concept as it was formally possible when UI5 Core resources were being loaded from a CDN.

If the tooling would allow to produce CSS bundles, a hash or version could be attached to the file name sap-ui-custom.x234dff.css and on-demand updating of invalide CSS resources files would be possible.

@RandomByte RandomByte transferred this issue from SAP/ui5-builder Nov 20, 2020
@RandomByte RandomByte added enhancement New feature or request module/ui5-builder Related to the UI5 Builder module labels Nov 20, 2020
@ddsultan
Copy link

@kristian, thanks for sharing first of all.

@RandomByte, is this problem also relevant for ui5 theme CSS files when built with self-contained flag?

@RandomByte
Copy link
Member

@ddsultan from my understanding Kristian is referring to exactly those files. I.e. the library.css files of the respective theme of all libraries used by the application. For example: https://ui5.sap.com/resources/sap/m/themes/sap_belize/library.css

Which CSS files are you referring to exactly?

@kristian
Copy link
Member Author

I reported this issue two years ago, but as I am referring specifically to applications, so I think I referred to the theming CSS files when multiple libraries are in use. @RandomByte you might can think about parsing the sap-ui-libraryPreloadCss prameter from index.html and if no app managed preload is used (no leading !), you can merge the theme libraries in the order they appear. If you are interested, look into my gulpfile.js and you should find code, which you likely be able to copy literally 1:1! 🙂 Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module/ui5-builder Related to the UI5 Builder module
Projects
None yet
Development

No branches or pull requests

4 participants