Simplify CSS and Javascript Compression In Visual Studio

I’ve released a new open source tool that performs design-time compression of your CSS and Javascript files in Visual Studio projects.  This can be a big help, since it allows you to easily do it in your project rather than as part of your build/publish process.  And, since it leaves both the compressed and uncompressed versions in place, you can still use the uncompressed version for debugging.

Read more about this new tool or download it at http://btburnett.com/netcompressor.

jQuery.themescript 1.1.0 Released

Today I’ve released version 1.1.0 of jQuery.themescript.  This release includes some significant improvements that make it far more functional in the real world.

The original design concept was for a web store framework I was working on.  I wanted each store be able to easily change their javascript based themes without making changes to the javascript files for the basic theme.  This made for a much easier file based deployment of new versions to each store.  The obvious downside is that you’re downloading lots of extra javascript, particularly if you’re turning features back off that were in the basic theme.  This type of functionality is only useful in certain cases, and is never the most efficient system possible with regards to performance and bandwidth, just maintainability.

This new release still maintains that basic functionality, but now I address a more common concern as well, applying themes to AJAX updates.  In order to support this, I’ve added several new features.

  • $.themescript.exec now accepts a context parameter.  This can be a jQuery object or an HTML DOM element, just like the context to jQuery’s jQuery(selector, [context]) selector function.  All registered functions will receive this context as a parameter, and it will be automatically used as the context to selector-based theming to restrict the elements returned.
  • themescript is a new function added to jQuery objects which allows you to execute the themescripts against a specific jQuery object.  $(‘#selector’).themescript() is equivalent to $.themescript.exec( $(‘#selector’) )
  • themescript( url, [data], [callback] ) works just like the jQuery load method, except that it will automatically run themescripts against the updated HTML if the request is successful.

You can also easily add support for jQuery.themescript to ASP.Net AJAX partial page updates (a.k.a. UpdatePanels).  Just add this script code to your files and the themescripts will be automatically executed against any UpdatePanels which are changed during an asynchronous postback.

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(function(sender, args) {
    var</span> updated = args.get_panelsUpdated();
    if</span> (updated && updated.length) {
        $.themescript.exec($(updated));
    }
});

Here are the links where you can access the GitHub repository or download the files:

GitHub
Download

LABjs.Net Release Candidate 1.0rc4

I’ve committed release candidate 4 of LABjs.Net at GitHub.  It contains a few minor bug fixes, and also adds a few useful features.

  • LabScriptCombine allows you to make use of the automated runtime script combining features of ASP.Net 3.5 in combination with LABjs script chaining.  To get the optimum script load time, combine scripts between each wait() call into a single HTTP request, so long as you are consistently using that combination of scripts across your pages.
  • Added some useful constructors to several of the LABjs.Net classes.  These constructors make it easier to build a LABjs chain in your code rather than in your .aspx files.
  • Made a slight change to the LabWait constructor that accepts an inlineScript parameter.  It will now default DetectScriptTags to False if you use this constructor, since you shouldn’t be including the script tags if you are building your chain in code.  You can still set this Property back to True if needed.
  • Added AlternateRef property to LabScriptReference.  If you’re using the experimental CDN failover extension to LABjs, it allows you to specify a full set of options for the alternate script.  The AlternateRef property allows you to make use of those options if you want to, by providing a full LabScriptReference class to use.  This is optionally used instead of the simpler Alternate property that just provides a URL.

Binaries
GitHub