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

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

Open
ScottRFrost opened this issue Jun 29, 2015 · 5 comments
Open

Comments

@ScottRFrost
Copy link

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
Copy link
Contributor

andre-d commented Jun 29, 2015

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
Copy link
Contributor

k3d3 commented Jun 29, 2015

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

@andre-d
Copy link
Contributor

andre-d commented Jun 29, 2015

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
Copy link
Contributor

k3d3 commented Jun 29, 2015

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
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants