Tweaking T4 Templates to Improve Script Performance
- Posted: Jul 08, 2011 at 10:49 AM
- 4,682 Views
Right click “Save as…”
In this DevNugget, a follow-up to part 1, Make Script Performance Automatic with Custom Templates in Visual Studio 2010, Developer Evangelist G. Andrew Duthie shows you how you can customize the T4 templates used for creating new Views in an MVC3 application, to move script references to the bottom of the page. Why the bottom? As explained in the previous installment, because some browsers won't load any additional content while they're busy downloading a script, so if you're loading a large script file from an external site, or if that external site isn't available, your entire page may be blocked from loading. Yikes!
Along the way, you'll learn a bit about quickly creating an MVC3 application using Entity Framework Code First and MVC3 Scaffolding.
For those of you who like your tutorials in step-by-step format, check out the accompanying blog post at devhammer.net.
Some additional resources: