I have a page which receives data from multiple sources and I need to create a set of handlers files to configure and display the different kinds of data. There could be 10-15 different kinds of data, each with it’s own display logic. Each handler would be fairly large and not just 1 or two methods.
I’m trying to figure out what would be the best way deliver an application like this, the only two options I can see are:
1) Create an individual handler file
for each type of data and externally load it in
when the page loads. The problem with
this is obviously including 10-15
different javascript files probably
isn’t a smart idea. Would I need to compress all the handlers into one file, minify it and deliver it compressed?
or
2) Do all the configurations on the
server before pushing the data to the
user. Here the problem is that the
JSON data pushed back could be very
large (plus would include HTML) and put a lot of
strain on the server.
Can anyone shed any light on how best to deliver complex javascript apps?
Actually I prefer your first option.
Combine and minify these JavaScript source files into a single one and cache it let Web browsers cache them in the client, meaning that subsequent requests wouldn’t need to download this combined-and-minified large file, boosting Web site’s performance and reducing network traffic.