The Blueprint
In the development of our web app, Mosaic, we are finalizing a lot of the core and how certain files are going to be best served to the browser. Recently, our focus has been our Javascript libraries and the best way to compress/cache them for minimal download time for the users.
The first roadblock I ran into is there is a TON of information out there on compressing and serving Javascript. In order to weed through it all the first thing I did was asked myself some questions that I thought were relevant.
- Which one makes the library the smallest?
- Which one is the easiest to use?
- Which one is most reliable across all browsers?
- Which one includes caching?
- Which one allows me to update a file and get it into the live codebase the fastest/easiest?
After sorting through the many utilities/methods, the front runners were Dean’s Packer, YUI Compressor, Combine, PHP Header Method and JSMin. The one utility that seemed to best fit our needs was a script called Combine. Combine is a PHP script that basically acts as a handler for all your javascript traffic from the server to the browser. There are a few PHP scripts out there that will serve compressed versions of your Javascript, but this is the Ferrari of all of the bunch.
So what exactly can it do? This script is so well written that is can do as much or as little as you desire or your users can handle. Here’s a break down of what all this script does for us.
It Combines
This is a gimme.. The first thing that Combine does is to ‘combine’ all your javascript files together and serve them as one large file to reduce the number of requests from the server giving a slight speed boost.
It Compresses
Combine detects if your browser will will handle gzip compression and if so, it will gzip the data and serve the compressed version. This will usually result in a sizable reduction in the file size you are serving.
It Caches
If you set up a cache directory it will store the gziped version of your data (that it generated) so that future requests simply grab the cached gzipped version instead of generating the gzipped content on the fly, which will reduce your server load by a small amount because the processors isn’t gzipping data on every request.
It Checks For Changes
This is probably my favorite part of the script. It will run a quick check on the timestamp and filesize of the cached data and if it has changed, it will automatically regenerate the file and serve the new version. It’s my favorite part of the script because, as far as I can tell, it handles the headers perfectly which allows me to change something in my Javascript and know that the users won’t be seeing the older versions. This has worked flawlessly through the past few months of development when our JS has been changing drastically every day.
It Allows For Realtime Editing
This may not be the exact term, but it’s a pretty close description. Because Combine doesn’t do anything to my original source files, I can edit them and upload/commit changes very quickly. With most scripts, you generally have to do all the compressing manually and then upload/commit that file. This takes a lot of time when you want to change something and mainly is just a hassle. I’m aware that you can write a custom serverside script that using the packer scripts such as YUI or JSmin but I think that is slightly out of the scope of the intermediate web developer.
So that’s the overview of why we’re using this script and you can read up more details on the authors site: http://rakaz.nl/extra/code/combine. You’ll also notice that this script can also be used to combine CSS files. We will probably implement this as well but for now our main intest is in getting the JS to a manageable size.
Next up in Part 2 we’re going to look at some real examples of how this script works, how we use it, and some benchmarks to show off how this script shines.
Six years ago Ryan, Phil, and I were part of the launch team for a local Church. From a group of about 30 initial members, the church has grown to over 400 regular attendees, two services, dozens of community groups and hundreds of volunteers. During this time the three of us have been involved in both serving and leading various servant teams within the church. After 6 years of leading hundreds of volunteers we have developed organizational tools and strategies that are rooted in team theory but tailored to the modern church servant team. Mosaic is our companies effort to provide other churches with proven organizational and communication tools.
Mosaic is described as an ancient and contemporary art form which uses individual pieces of materials placed together to create a unified whole. Individual pieces (tesserae) are arranged in groups that move and flow (andamento) throughout the entire work of art. This fluid organization of individuals into a seamless whole is what we are creating with mosaic. Our tesserae are not pieces of tile or glass but people and our andamento is not a pattern in art but structure and organization of servant teams in the modern church.
Mosaic is not designed to be your traditional “membership/volunteer” database. While we recognize the need of some organizations to employ large complicated software to track everything from birthdays to anniversaries, and family trees to blood type we believe that most groups simply need a tool to manage the organization, scheduling, and communication between volunteers. Mosaic is intentionally simple. We don’t ask for members’ maternal grandmother’s maiden name. You don’t even need a complete organizational plan to get started. All you need are people…we’ll help you organize and stay in contact with them.
Over the next few months we will be posting more detail about features within the application and screen shots of the four core areas that comprise Mosaic.
Teams
All your info about your people and teams in one place
Messaging
Communicate easily with people and teams through Mosaic or email
Event Calendar
Tie your teams to events to easily track who is needed, when
Sub-Finder
Know when people can’t show up and easily find a replacement
These four core areas will work together to solve the major issues that surround team management even if you’ve never had to manage people before. The best part is that we’ve built Mosaic based on our years of experience (good and bad) managing servant teams. Our goal is to take the headache out of managing your servant teams and just let you serve.