Javascript Combiner/Builder


Javascript Combiner/Builder

by Blake Anderton

We’re at the point of trying to optimize LANDBOSS, and one of our first tasks was to combine our multitude of javascript files into a single one.  Many browsers do not handle a large amount of requests on a page load gracefully, and it can become a major bottleneck.  The problem we ran into was:

  • Javascript code can be difficult to maintain simply due to what the language encourages, developing in a single file would make a large application almost impossible to work with
  • Using multiple javascript files causes many HTTP requests on page load
  • Tools to combine multiple javascript files into a single one were all lacking

On the 3rd item I suppose I should explain what I mean by “lacking.”  I tried out a couple tools already available to combine/build a single javascript file, but each tool exhibited one or more of the following:

  • Required a list of every single file to combine (meaning if you added a file you had to remember to update your list)
  • Was not able to place certain dependancy files before the files that used them
  • Was generally buggy and unreliable

So, to remedy this the LANDBOSS team and I decided to make our own.  And so the “InterWorks JS Build” program was wrought in the dimmly lit cubicle-forge of Runak’Dur.  It’s a terribly named, but rather useful program.  It’s a command-line (read: automatable) .NET executable that uses a simple XML project file to include/exclude specific files or entire directories in the order you specify.  It also uses the YUI Compressor for .NET to minify the results.  All the guts are in a separate dll in case you want to put a spiffy GUI on top of it or something.  We’ve integrated this application into 2 of our projects already with smashing success, and encourage you to try it on your own projects.  You can find a download link below, and the readme file documents how to make the XML file and run the program.  Enjoy!

More About the Author

Blake Anderton

Software Architect
Querying Specifc Inheritance Types in Entity Framework The Problem When using Entity Framework let’s say you set up a model with inheritance. Let’s make ourselves a simple ...
Simple Long Polling in WCF – Server Recently I’ve been working on a RESTful HTTP server in WCF for a really cool project that isn’t public yet, but should be ...

See more from this author →

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK


Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Geschäftsführer: Mel Stephenson

Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072


Love our blog? You should see our emails. Sign up for our newsletter!