Thursday, March 03, 2011
Filed under: umbraco
- by Douglas Robar
Razor, a new Umbraco macro language
Umbraco 4.7 RC has an all-new Razor macro engine, a foretaste of the coming MVC goodness of Umbraco 5.
As everyone knows, I'm an XSLT fanboy; it is lightning quick, powerful, an open standard, and I don't have to open a Visual Studio solution every time I want to make a minor change. Besides, my C# skills aren't amazing. Thankfully with Umbraco, I don't need to be a .NET guru.
I've always been a little uncomfortable with how wide the gap is between XSLT and .NET macros though. With Razor, we may have found the middle ground. Razor just might be the go-to language for most macros from now on, though I'll need more time with Razor to know for sure.
My first Razor project, RazorSearch
As a first project I'm writing RazorSearch for Umbraco. Basically, I'm recreating the functionality of XSLTsearch by implementing it with Razor.
As some of you may know, XSLTsearch was originally written in Notepad. I don't want to repeat that terrible editing and debugging experience. I'd like to use something more helpful as I learn Razor.
Visual Studio and (no) Intellisense
I fired up Visual Studio 2010 Professional, opened my local website, and was hoping for a lot of intellisense magic to give me hints along the way.
Intellisense was missing for @Model. I (and a lot of other early adopters on twitter) wanted some helps. How can I get some intellisense love with dynamic objects that are not determined until runtime?
Make Intellisense and Debugging Work
Being easier to show you how to do it than write about it, here's a short video that demonstrates how to get as much Razor Intellisense for Umbraco 4.7 (RC) macros as I've been able to come up with so far.
As an added bonus, I also show how easy it is to debug Razor macros without having to compile the source. It's really easy!
Watch on YouTube
As you begin your Razor macro journey, you may find the following resources helpful. I sure have!