Skip to content

Commit

Permalink
Inline SVG
Browse files Browse the repository at this point in the history
Having the SVG files loaded as a separate package significantly
increases the load time of the UI, as it forces the images to be
downloaded AFTER the page has loaded.

This commit adds the vue-svg-inline-loader, and appropriate config such
that the styles can be inlined, and a second trip to the BMC is not
required to load the login screen.  This improves the "time to glass" of
the webui quite a bit.

Tested: Webui loads.  Network tab shows svg files are not loaded.  Webui
login page looks correct.
First load of the webui renders 500ms faster (1.9s vs 1.4s)

Change-Id: Iebcd9ab5df6edad0a1a5c53c028eccd2fda8f63c
Signed-off-by: Ed Tanous <[email protected]>
  • Loading branch information
edtanous committed Apr 8, 2024
1 parent d4eaf8b commit f820774
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
36 changes: 30 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"sass-loader": "8.0.0",
"vue-cli-plugin-i18n": "0.6.1",
"vue-server-renderer": "2.7.16",
"vue-svg-inline-loader": "2.1.5",
"vue-template-compiler": "2.6.12",
"vuepress": "1.8.2",
"yorkie": "2.0.0"
Expand Down
2 changes: 2 additions & 0 deletions src/layouts/LoginLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<div>
<div class="login-brand mb-5">
<img
svg-inline
width="90px"
src="@/assets/images/login-company-logo.svg"
:alt="altLogo"
Expand All @@ -22,6 +23,7 @@
</div>
<div class="login-aside__logo-bmc">
<img
svg-inline
height="60px"
src="@/assets/images/built-on-openbmc-logo.svg"
alt="Built on OpenBMC"
Expand Down
6 changes: 6 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ module.exports = {
port: 8000,
},
productionSourceMap: false,
chainWebpack: (config) => {
config.module
.rule('vue')
.use('vue-svg-inline-loader')
.loader('vue-svg-inline-loader');
},
configureWebpack: (config) => {
const crypto = require('crypto');
const crypto_orig_createHash = crypto.createHash;
Expand Down

0 comments on commit f820774

Please sign in to comment.