-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: reduce size CSS output file #266
Conversation
Thanks for the pull request, @ghassanmas! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
07a2dd2
to
876e540
Compare
@ghassanmas Thanks for your contribution! Please let us know when it's ready for review. |
Hey @jmbowman, this is ready for engineering review by the FED-BOM team now. |
876e540
to
44b6972
Compare
44b6972
to
450c6f1
Compare
[Update]: Testing: I have tested this version on frontend-app-learning, by installing this version of frontend-build: see this PR openedx/frontend-app-learning#1047 The effect of this is that the css way more than expected. I don't rememeber how I test it when I opened the draft, but in any case this cannon be merged as it is. I am going convert it to draft again, and when time allow I will dig into the correct settings. s |
[Update] I think I made it to work with learning MFE olive, CSS file size was decreased 70% (few hundred kilo bytes). I had to completely set it in a different way, please check the expected diff at ghassanmas#1 . If that can of change acceptable I would tidy up and update this PR accordingly, |
The test on MFE LearningBefore This changeCSS File size: 132KB GIZ /883K/Original Live link: https://apps.olive.zaat.dev/learning/course/course-v1:zaatdev+101+1/home After This changeCSS File size: 27KB GIZPPED/ 278K Orginal Live Link: https://learning.olive.zaat.dev/course/course-v1:zaatdev+101+1/home ConcolusionIncreaing lighthouse performance by 20% |
Its improving the build size but build time is affecting greatly with these changes. I have tested it on multiple MFEs and following are the results: frontend-app-learner-portal-enterprise: frontend-app-learning: @arbrandes what are your thoughts on this? |
Yes I expected that would occuar, but for me I think the priority comes first for end user which is leaner. For example at 2U/edx you do one build for milllions of users, compare those few seconds with a fraction of second of for million of users. Edit: Digging into numbers the channge seems reasonable for learning, but for others it's way too much, also it could you please set how you did the build, with optimizizaiton was there somehting working on computer while building? were you building concurrently....etc [Edit] on reapting test on the account MFE, the average increase time is ~30% |
I have to be honest: I don't much like CSS removers. There's too much risk for too little reward. This article outlines some of the dangers: https://css-tricks.com/how-do-you-remove-unused-css-from-a-site/#aa-part-of-a-build-process The added build time is also bad. We're trying to reduce it for many reasons, and this will make it much worse. I don't think saving 100KB of downloads is worth it. What I'd be more interested in is ways to avoid having to insert framework CSS when it's not necessary in the first place, possibly by picking more modular frameworks. |
@ghassanmas A friendly reminder to follow up on @arbrandes's comment above. |
@itsjeyd we have discussed this in the last FWG, https://openedx.atlassian.net/wiki/spaces/COMM/pages/3645964289/2023-01-26+Frontend+Working+Group+Meeting+Minutes. And I think @arbrandes want to check with folks opinion before merging it. |
This is again ready for review:
|
@arbrandes following your suggestion I made it optional, and as for tutor-mfe I geuss it worth mentioning this option, and I would suggest that the default tutor-mfe image to use it since it would be build once and used many times. |
label: core contributor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in principle, but I think the code could still benefit from a couple of changes.
Thanks for bearing with me, @ghassanmas.
e3d0f15
to
6680a85
Compare
@arbrandes no worries, I did your suggestion and have rebased to single commit. Have tested again:
Testing while applying the following patch in account MFE:
|
@ghassanmas Looks like this is getting closer to being merged :) Could you please resolve merge conflicts and ping @arbrandes for another round of review when done? |
The added plugin, reduce the CSS file by removing unused CSS The plugin is kinda recommended by bootstrap[^1], reducing unused CSS is generally recommended as well enchance web perforamce[^2] [^1]: https://getbootstrap.com/docs/5.2/customize/optimize/#unused-css [^2]: https://web.dev/css-web-vitals/#critical-css Related issue: openedx/wg-frontend/issues/138
6680a85
to
e6fd704
Compare
@itsjeyd done from 32-155 :) |
Thanks @ghassanmas! @arbrandes Back to you :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! As usual, thank you for you patience, @ghassanmas, and congrats on pushing this to completion.
@ghassanmas 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
🎉 This PR is included in version 12.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This is ready again for review, see below for testing detials and result
[Update] 18.01.22 As of testing with olive MFE learning, the CSS output was missing a lot of stuff. Converted to draft again, need to double check the correct settingsThe added plugin, reduce the CSS file by removing unused CSS
The plugin is kinda recommended by bootstrap1, reducing
unused CSS is generally recommended as well enchance web
perforamce2
Related issue: openedx/wg-frontend/issues/138
This is still work on progress, I need to do further testing, to ensure this change doesn't break styling or any other thing
Footnotes
https://getbootstrap.com/docs/5.2/customize/optimize/#unused-css ↩
https://web.dev/css-web-vitals/#critical-css ↩