do-me / SemanticFinder

SemanticFinder - frontend-only live semantic search with transformers.js
https://do-me.github.io/SemanticFinder/
MIT License
210 stars 14 forks source link

Separation of Concerns regarding CSS/JS #2

Closed kungfooman closed 1 year ago

kungfooman commented 1 year ago

Can you create separate files called index.js and index.css?

do-me commented 1 year ago

That's definitely the right thing to do in the long run. In the beginning I just wanted to keep it as simple as possible for anyone to download the index.html.

There is actually a function for downloading the entire file with one click which would be more complicated to do if you have everything (properly) separated.

My initial plan was to allow everyone with

  1. index.html
  2. a browser
  3. any PyTorch model

and without internet connection, to perform local semantic search. The user would simply download the model and enter the path e.g. with filepicker. Note that if you just load index.html with your browser you don't even need a server running, which is quite convenient.

I don't know whether webpack or similar tools might allow a convenient "one-file" html export. If so, I'd propose to continue as follows:

  1. Split the index.html in js, css, html
  2. Have some CI building the one-file index.html in a dist folder

Would make it easier for debugging and development, totally agree!

If the one-file build is not feasible, I'd just keep a one-file version on my homepage but still go the "proper" way.

Also, in the coming week I want to activate CI and GitHub pages, making it easier for development and properly separating the repo from my blog.

lizozom commented 1 year ago

I added a PR that does just that.

I could easily add and commit the dist directory, if you'd like me to!

do-me commented 1 year ago

Yes that would be great too!