Monday, November 28th, 2005

JavaScript Utilities Project

Category: Utility

The creatively named JavaScript Utilities Project is oriented at developing a set of tools and components geared toward enhancing the development model around JavaScript as used for implementing rich Web applications.

The project introduces the notion of .jsx (extended JavaScript) and .jsa (JavaScript assembly) files. JSX files provide the ability to include conditional code via familiar preprocessor directives such as #if, #else, #endif and so on. I have also introduced a special single-line syntax to avoid requiring a terminating #endif for convenience: ## DEBUG. The tool processes these directives in order to produce a standard .js file. JSA files build on top of .jsx files. While they can include normal JavaScript and preprocessor directives, they are primarily there for including individual .jsx and .js files via #include directives. This allows you to split your script into more manageable individual chunks.


The functionality can be used in three modes:

  • A set of standalone tools that output standard .js files that you can then deploy to your web site. Command line parameters are used to control the behavior of the tools.
  • A couple of IHttpHandler implementations that allow you to dynamically convert your code into standard .js files. This is the mode where you can benefit from implementing per-browser code in a conditional manner. AppSetting values in configuration are used to control the conversion behavior.
  • As a script project in VS using an msbuild project along with an msbuild task that comes along with the project. MSBuild project properties are used to control the conversion behavior.

Are these additions compelling? There are issues with extending the language in this way, because now any of your tools that grok .js files, are going to be confused by the #directives.

Posted by Dion Almaer at 6:38 am

4.1 rating from 9 votes


Comments feed

Just to let you know i found this great place to make holiday cards. They are usually like $20 but free if you click on this link. I am going to put my christmas letter and favorite family picture in them for christmas cards this year. If your interested

Comment by melissa — December 2, 2005

The only company with full service printing, mail services, graphic design, web design, and eCommerce on the Outer Banks.

Comment by Coastal Impressions — April 26, 2007

Leave a comment

You must be logged in to post a comment.