Separate the fonts from the lcars-sdk.css file#11
Open
sfranzyshen wants to merge 8 commits into
Open
Conversation
Update 4.0
Splitting the fonts out of the lcars-sdk.css and making a separate file allows for options at build time ... for example ... embed the web fonts in the css ... most modern browsers support woff2 ... but i left in backward support ... also more work needs to be done to account for supporting css variable fonts ... to reduce the css size by only including the base64 once for each font ... but it's a start to building out a 2 file (lcars-sdk.js & lcars-sdk.css) setup for deployment ....
... to re- add the fonts back in include either font css file ... for the default setup (references fonts files) use <link rel="stylesheet" type="text/css" href="lcars-sdk/fonts/sdk_fonts-default.css"> or the embedded woff2 ... <link rel="stylesheet" type="text/css" href="lcars-sdk/fonts/sdk_fonts-embed.css"> ... this is working towards a two file deployment ... with no filesystem hierarchy location dependencies ... ie: [interface html] <script type="text/javascript" src="lcars-sdk-19182.4.js"></script> <link rel="stylesheet" type="text/css" href="lcars-sdk-19182.4.css">
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We propose moving the @font-face declaration from the lcars-sdk.css file and into a new file located within the fonts folder. This way it won't matter where the file is called from relative to the font files. With the current method the declarations reference the font files with a preceding "../fonts/" this creates a dependency to the file system hierarchy relative to the referenced font files. When deploying with the full sdk file system layout ... this isn't a problem ... but alternate deployments are restricted or not possible.
For example we are deploying on a rpi4 running chrome browser ... so we don't need all the fonts for our deployment. In fact we use base64 embedded fonts so we we don't need font files at all ... and we have the entire lcars-sdk deployed as just two files. We provided a comparison between the two methods below. the first version is all default (except for separating the font declarations from the lcars-sdk.css file) The second version is our slimmed down minimized deployment ... We have also included images comparing the profiling (loading of the page performance chart) for both methods ... as you can see there is a good deal of performance increase and reduced load time ... so this is our reasoning and justification for separating the fonts from the lcars-sdk.css file and into a separate file ...
Default
https://sfranzyshen.github.io/LCARS-SDK-ARCHIVE/19182.4/interfaces/color-generator/index.html
https://sfranzyshen.github.io/LCARS-SDK-ARCHIVE/19182.4/interfaces/color-generator/index.png
Embedded
https://sfranzyshen.github.io/LCARS-SDK-ARCHIVE/19182.4/interfaces/color-generator/color-generator.html
https://sfranzyshen.github.io/LCARS-SDK-ARCHIVE/19182.4/interfaces/color-generator/color-generator.png