This project is read-only.

Getting T4MVC Links to Play with Chirpy minified individual js and css files

Aug 2, 2012 at 3:57 PM

I hope I'm not missing anything but it hardly seems like this is solving the problem that the person was referring to.  I don't want to have chirpy associate a css or js minifier for all .js or .css files in my solution since quite a few are from third party sources that already have an unminified and minifed version in the solution.

I like using the Links generated code for the selecting of unminified vs minified js or css file based on if debugging is enabled.  The issue I run in to is when I allow chirpy to manage my minification of a single JavaScript file by ending my files with .yui.js, .msajax.js, or whatever minifier you are using.  

Say if I reference a single file located in ~/Scripts/myfile.yui.js, Chirpy will generate a minified version called ~/Scripts/myfile.min.js.  T4MVC will look for my minified file at ~/Scripts/myfile.yui.min.js if I have used the Link.Scripts.myfile_yui_js generated link.

The only way around this that I can think of is to modify the and template to look for the allowable extensions for css and js.  When it attempts to look for the minified version it will just remove the [.yui, .msaja,....].

I'm hoping that I'm overlooking a more simple solution than what I am thinking.  Any help or recommendations on this is greatly appreciated.

Aug 2, 2012 at 5:52 PM

So trying to understand this. Are you saying that anytime you have, then we should look for a minified file called Some.Name.min.js? Or is that only true when 'foo' is one of a known set of strings like yui?

And do you know why Chripy generates myfile.min.js instead of myfile.yui.min.js? On the surface, it would seem more logical to always add a 'min' token after minifying a file, no matter what the file name is before minification.

Aug 2, 2012 at 6:22 PM


I just want to say thank you for the fast response and awesome work on T4MVC and WebActivator.  These are absolute must haves for my daily MVC development.

I was hoping to be able to just set an option in the visual studio extension that would just output minified names based on the extensions Chirpy looks for.  So in your example would have a minified version called  This doesn't seem to be configurable for the individual files that chirpy minifies based on filename.  There is a work around after digging in to the "mashing" features of Chirpy.  You can now configure bundling and minifcation via a web configuration file where you have full control over file names which will play nicely with the generated Links from T4MVC.  It's not an ideal solution for just managing minifcation of single files that aren't being bundled but I can live with it.

I'm not sure as to why Chirpy generates it's file names the way it does.  I was going to propose having a new string[] variable in the settings file where chirpy users could define their extensions that their chirpy is using and then have the T4 template updated to look for those.  It's probably not a concern for T4MVC really which has made me hesitant to request anything like this plus it's been out for a while without any other complaints of this feature.  That's why I was hoping to have some other Chirpy users tell me that I could override the minified filename to match what T4MVC is expecting.  Like I said I can live with just defining it in the config file.

Aug 2, 2012 at 6:28 PM

Hi Justin,

Thanks for the good feedback of T4MVC and WebActivator!

It may be worth posting a question (or a link to this question) on the Chirpy forum (, as it's more likely to hit the Chirpy experts.

But if at some point you find a way to improve the way T4MVC handles this, we can certainly discuss possible changes. And pull requests are always appreciated :)