Upload / Up1

Client-side encrypted image host web server
MIT License
811 stars 97 forks source link

Bundle and minifiy CSS & JS on production / demonstration server #12

Open ScottRFrost opened 9 years ago

ScottRFrost commented 9 years ago

https://up1.ca/ includes a dozen locally hosted CSS and JS files. For performance, the reference implementation should probably bundle and minify these files.

It's generally considered best practice to have exactly 1 .js and 1 .css locally served.

andre-d commented 9 years ago

This was not a concern early on due to the SPDY layer available to us solving some of the overhead there. Is there any advantage to doing so with HTTP/2 or SPDY in front? In theory the entire/most of the connection overhead is gone, might be some JIT and GZIP overhead though depending on how that is multiplexed and how much the JIT likes us though.

There may be some other advantages to version'd blobs though like hashes of single releases being posted publicly with verifiable builds, makes the chrome/FF extension (once that is finished) simpler, version numbers can be bumped so there is less cache worry, makes the client html simpler, etc.

There are a couple quirks we need to resolve with the web worker being in a single file, but sjcl can just be piped in and that entire thing and we can just host them as two files. The entire thing can really be reduced to a css file, an html file, and two js files with checksums posted publicly as explicit reproducible versions.

k3d3 commented 9 years ago

Ah that's true, I completely forgot about the web worker. That might be a blocker to something like this

andre-d commented 9 years ago

It is not really, there are two things which can be done:

1) Web worker stays isolated, you have two JS files (I prefer this option as it sounds like much less of a hack)

2) Web worker is defined inside a blob and the blob URL is used

k3d3 commented 9 years ago

In any case, it's probably a good idea to eventually minify, bundle and compress the files for the up1 server.

@ScottRFrost That being said, we currently don't have it minified because the demo/prod server is meant to be very open with the code, for the sake of readability. The files themselves are small enough that there isn't all that much of a performance impact. We'll likely add in a grunt script to minify+bundle+compress the code and make it an option rather than a requirement. Thanks for the input!

ScottRFrost commented 9 years ago

@k3d3 then minify it with a .map file. There are lots of tools to do this. You get all the performance of minification while still being able to debug.