Better Cassette Bundling

We use Cassette v1 for our company site mainly because that’s what there was for bundling back in those days. Since then v2 has been released and MS has bundling and minification baked in to MVC now. But, as a wise man once said:

“If it ain’t broke, don’t fix it!

Mostly I follow that logic when I am being lazy – and since the whole bundling thing is gonna boil down to a different syntax to do the same thing, I figured why bother. Heck, I did not even want to bother going to v2!

I just decided to add the slick Select2 list to an admin page, and it made me push on an edge of Cassette that I had not run into before: how to easily exclude a folder. In short, there is no built-in easy way. However, I found a great post about using Cassette for semi-complicated scenarios. There is an excellent snippet of code in there that extends the FileSearch class and makes excluding folders as easy as this:

    new ExcludeDirectorySearch("*.css", new [] { "ckeditor", "ckfinder" }));

A cassette gem!

Man, I cannot believe I did not know about this before. Cassette has some pretty decent documentation, and I have combed over it, but either this was never listed before or I just missed it. I am using v1.2, and I recently noticed there is a v2. In the upgrade notes, there is a mention that the diagnostics page moved. I had no idea there was a diagnostics page!

For example http://localhost:2452/_cassette#stylesheets (debugging locally, obviously) produces this nice little dashboard:

Cassette diagnostics dashboard

Cassette diagnostics dashboard

I wish I would have found this a few months ago…