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

Refactor the demo UI (reduce ~520KB of static assets to ~4KB) #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

knadh
Copy link
Collaborator

@knadh knadh commented Nov 25, 2023

I was checking the lib that the demo UI uses to render suggestions that appear as you type (for Olam's transliteration page). Realised that it was using CodeMirror, a 65KB+ lib only for suggestions, which is unnecessary. Also noticed that there were a lot of other dependencies including jQuery and that the demo page assets amounted to 520+ KB.

I ended up writing a zero-dep lib (@knadh/floatype.js, ~1200 bytes) that renders floating suggestions as you type for Olam.

This PR gets rid of 520+ KB of dependencies and static assets that were used to render the simple demo typing page with a new page amounting to <4 KB.

Hope I didn't miss anything obvious here.

image

@knadh
Copy link
Collaborator Author

knadh commented Nov 25, 2023

@subins2000

- Remove all JS dependencies (jQuery, CodeMirror etc)
- Remove redundant stylesheets other assets.

This PR gets rid of 520+ KB of dependencies and static assets that were
used to render the simple demo typing page with a new page and a new
autocomplete JS lib that total to <4 KB.
@subins2000
Copy link
Member

Thank you for cleaning things up :). Except for floattype everything can be merged. I'll modify the PR to use the already bundled embed script.

Can't use floattype because:

  1. The embed script is already bundled with the varnamd binary: https://api.varnamproject.com/embed.js . It's just that it never got used in ui/
  2. Doesn't have all the IME features of https://github.com/varnamproject/webIME

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.

2 participants