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

Separate the fonts from the lcars-sdk.css file #11

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

sfranzyshen
Copy link

@sfranzyshen sfranzyshen commented Jul 7, 2019

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

  • please allow six weeks for your delivery Thank You

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">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant