I have been doing a fair bit of web oriented coding recently, finally getting to grips with Javascript and newer web technologies. The upshot is that I nearly have a new tool for visualising argumentation structures ready to push to my github account. In getting ready to do this I started finding out about things like
minification and packaging for Javascript files to make the downloads as efficient as possible. The
general consensus seems to be that you minify and package everything up into a single Javascript file which gives you the best trade-off of minimising the number of HTTP connections and minimising the amount actually transferred but without the computational overhead of unpacking.
One thing I was unsure about was how to handle versioning at deploy time, especially as I move towards continuous deployment of various projects. Turns out that one way of doing this is to name the Javascript file with the hash of the file instead of just calling it all.js or adding a query string. This gives a unique name for your src file without subjecting you to the vagaries of any cloud deployment infrastructure that may be operating on eventually consistent principles. This is nicely explained, with diagrams in
this post over at
Ben Kamen's blog. In the comment thread from that post, one commenter
suggests also that using an Amazon S3 bucket to hold Javascript files and ensuring to deploy the new Javascript file there before any code that accesses it is made available to users is a good approach also.