Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SquishIt vs. MVC 4.0 Bundler

I have a an ASP.NET MVC application and I presently use SquishIt to help bundle all of my CSS and javascript files into a single element downloaded from the webserver for every hit to my site. I know that recently MVC introduced its own bundler. Has anyone done some comparing between the two of them? Is one better for certain situations vs. the other? Or are they basically the same? With the MVC bundler, does IIS still need write access to the site directory?

Any and all thoughts and comments you may have would be appreciated.

Thanks.

like image 658
KWondra Avatar asked Jan 29 '13 12:01

KWondra


2 Answers

I am pretty biased on this but its a good question - I haven't thought about this as much as I should but I have started.

SquishIt doesn't actually need write access to the file system - it has a Cached Bundle Mechanism that works without write access to the site directory (it caches bundles in memory and serves through a special controller/handler). Not sure if the MS offering has this capability.

Both work at runtime and yield a pretty good debugging experience.

Both have similar mechanisms for utilizing preprocessors (.less, coffeescript, etc...). MS' offering seems a bit more flexible, but maybe clumsier to use. SquishIt's preprocessing behavior is modeled off of the asset pipeline in rails, and doesn't provide any means outside the chain of file extensions to control the order preprocessors get applied.

Both allow inclusion of directories and files. SquishIt also supports adding arbitrary fragments of javascript or CSS (retrieved from a database, etc...) to bundles, I don't see anything like this in the MS offering.

SquishIt has an extensibility point that allows writing your output file to a CDN - again I haven't seen anything like this in the MS offering.

Hopefully others will fill in the gaps here - I will try to remember to come back and update as I learn more.

like image 63
AlexCuse Avatar answered Nov 03 '22 02:11

AlexCuse


I haven't looked into the details and extensibility points etc as much as @AlexCuse but his general take seems to be mine.

Squishit seems to have the edge.

For me (and I think I MUST be missing the obvious somehow - but I don't have time / inclination to write my own custom IBundleOrderer implementation and can't find the solution I expect in docs / googling)

the MVC / MS offering has one MASSIVE FAIL...

I cant see how I can get it to simply honor my declared order of scripts and css files !

Which totally sucks balls for obvious reasons. (i.e. its utterly screwed up my app - with 20+ little css / jscript bugs all over my large complex app - those frustratingly hard to pin down little display bugs and odd js quirks)

Rick Anderson say's "adding a custom IBundleOrderer implementation, but explicitly adding each file is less error prone." But I can't see how to do the latter - I am explicitly using .Include( for each file. Mainly my order is honoured, but annoyingly not totally - clearly some default rule comes into play and the system decides it knows better than me.

Admittedly there must be a simple answer here - but I can't find it so for me this is a MASSIVE MASSIVE FAIL, and means I am now going to the trouble of reverting back from MS implementation to Squishit which did the job very nicely thank you !

N.B. also had problems with 1. the way its Minifying the js... its introduced bugs I just don't need. I did to be fair have some issues with Squishit but solved fairly easily. 2. the way its minifying the css

Minification failed. Returning unminified contents.

I'm reverting to Squishit.

like image 30
MemeDeveloper Avatar answered Nov 03 '22 01:11

MemeDeveloper