-
Notifications
You must be signed in to change notification settings - Fork 132
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
Optimize icon assets #2082 #2357
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2357 +/- ##
==========================================
+ Coverage 45.22% 45.66% +0.43%
==========================================
Files 123 123
Lines 5183 5199 +16
Branches 1089 1097 +8
==========================================
+ Hits 2344 2374 +30
+ Misses 2520 2506 -14
Partials 319 319
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Currently there are some issues faced in cheerio parsing. The Any ideas on how to do so? 🤔 |
Update: It's okay, this is resolved |
|
Hi @tlylt,
|
Can we add these in the existing site instead of creating a new one? |
The existing test_site contains icons in the site-nav and I plan to create a new site that is clean of icons in the layouts, so I can test the page content independently |
Is testing the page content "independently" absolutely necessary? I assume you can test the conditions that some pages don't have certain icons? If we have to, can we remove the icons in the layouts? does that impact any existing test cases? Best not to add a new site when there's no need to, for the sake of reducing noise in the test suite. |
Hi @jmestxr, I observe that with this change, pages that don't include certain icon assets will still have the link tag but with empty href attributes, e.g. on https://deploy-preview-2357--markbind-master.netlify.app/ Is this a concern? Can we properly remove them? Or are there issues with removing them entirely? |
Hi @tlylt, I have managed to remove the empty tags. |
Hi @jmestxr, I have not gone into the code. Found some issues with modal (and possibly with the "include" feature?)
|
Hi @tlylt , thanks for catching this. I have updated the code to fix this. In addition, I have tested on modals, panels, quiz. For tabs, this PR isn't the issue that icons could not be rendered. |
Hi @jmestxr, I am still seeing issues with modal:
Sorry you mean there is a problem with icon display in tabs right now? 👀, is this reported? |
@tlylt I did not realise that some vue components also use icons provided by font awesome/glyphicons etc. I have updated
Yep, I have tried this in the master branch and observed that the slot in the tabs seem to only be processed as text only, e.g.
renders as Removing the empty newlines in the markdown code still also renders the content as text. |
Got it, any performance impact that you observe/foresee for this update?
Could you help me raise an issue for this? |
From what I see, there's no significant change in build time, and time taken to load CSS assets, even for larger icon files like all.min.css (font-awesome styles). |
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.
Hi @jmestxr, thank you for addressing my earlier comments. I think this is mostly ready. I tested locally and seems like it's able to handle edge cases of Modal/Tooltip/include etc.
I left some comments regarding functional test outputs not being accurate according to the description (they still include the other icons), which hopefully will be the last minor issue to tackle.
Lastly, don't forget to update your PR description.
packages/cli/test/functional/test_site/expected/testFontAwesomeInPage.html
Show resolved
Hide resolved
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, thank you @jmestxr
What is the purpose of this pull request?
Exclude icon asset CSS files (i.e. font awesome, material-icons, glyphicons, octicons) from being loaded if they are not used in the page
Resolves #2082
Overview of changes:
Implemented
filterIconAssets(preVueSsrHtml: string, postVueSsrHtml: string)
where:Anything you'd like to highlight/discuss:
Testing instructions:
packages/cli/test/functional/test_site
. Runmarkbind serve -d
.testGlyphiconInPage.html
,testFontAwesomeInPage.html
,testMaterialIconsInPage.html
,testOcticonInPage.html
.testIconsInSiteLayout.html
.Proposed commit message: (wrap lines at 72 characters)
Optimize loading of icon asset files
Checklist: ☑️