Wednesday, July 21, 2010

T4MVC add-in and resource compression update

The T4MVC add-in and the dot less css add-in add-ins have been officially merged into the chirpy codeplex project.   Really love the design time javascript/stylesheet minimization and combination. This is really a great project and one of my favorite add-ins...of course I am not biased in any way.  :-)

You can read all about the features of this with Evan Nagle's latest post here.  In addition to his post on how to install, don't forget this add-in is in the VS2010 extension manager - so that should make it really easy to install and update.

One of the new T4MVC related features put into the latest release is 'Smart Run T4MVC'.   If you turn on this option in the chirpy settings, it will only run the T4MVC template when it should.    That means it will only run it if you change a MVC file that would cause it to be refreshed - instead of on every save operation.  Of course it relies strongly on convention locations to determine this.   It runs the template if any of the following happen:

Add/Remove/Rename any file in /Content or /Scripts
Add/Remove/Rename/Edit any file in /Controllers or /Areas/{anyarea}/Controllers
Add/Remove/Rename any file in /Views or /Areas/{anyarea}/Views

For those people with _really_ large project and/or slower computers, this should help with any speed issues and in general is just a good optimization.  If you turn this feature off, it runs the template when you save any file like it used to.

Wednesday, March 17, 2010

Style sheet compression and .less add-in...updated with source

6/2/2010 Update - Project enhanced and now on codeplex!

Design time minification and .net less for style sheets.
Read my previous post on this subject.  

Known Issues
It has been reported that this does not work in 'web site project'.  I do not  use those anymore, not since they brought back our 'web application project'.  If anyone wants to try and make it work, the code is attached.

Source Code
I finally got around to updating this to the latest version of the less engine and api.   In addition, I had been promising source code for a while now.

Click to download

Shout it
kick it on

Tuesday, March 16, 2010

T4MVC Add-In to auto run template

6/2/2010 Update - Project enhanced and now on codeplex!

T4MVC is a fantastic solution to avoid 'Magic Strings' in ASP.NET MVC.   

Thanks to David Ebbo for this contribution which has made its way to MVCContrib.  

Must keep T4 template open and save it once.
This has been the only negative thing about the template.  I thought about writing an Add-In for VS to do this and even taked to David about doing it.  Well, his latest post has inspired me to write one.  I took my dot net less plug in and ripped nearly everything out of it, threw in about 5 lines of new code and it is done.

There isn't any.  Just install the add-in and it should work.  It watches for any save, add, or remove event to the solution and runs the T4 template at that time.  As long as you have the file in  your project it will run.

I have attached the source and binaries.  I am sure there are some improvements we all can make.

Simply download the file and double click to install into your Visual Studio Add-in folder.  Currently I only have tested this for VS2008, however should be easy to make work on 2010.  Full Source

What do you think?

Shout it
kick it on