This is a mirror of official site: http://jasper-net.blogspot.com/

CodeRush Templates – Creation Basics

| Friday, November 5, 2010
Even the simplest of CodeRush Templates (one without any TextCommands or StringProviders) can be really useful. Such a template expands exactly the same every time it’s used.

In this post we’re going to create one such simple template.

Our scenario is one in which you are building a web page and you’d like to quickly generate some simple but authentic looking text to flesh the page out with.

This scenario is typically dealt with using lorem ipsum text. This text is typically generated by a computer to the specification of a user. It has similar flow to most Latin based languages and makes for realistic looking content, when mocking out a page.

We’re going to make a template which delivers the same paragraph of Lorem Ipsum each time it’s invoked. You’ll be able to type “lorem<space>” and have it expand to the pre-calculated piece of text.

So let’s not hold back any more… let’s get on with it.

Which language?

Open up the Templates options page and change the language dropdown to HTML (Details here).
We’re doing this because it’s rarely useful to inject quantities of “lorem Ipsum” text into VB or C# code. Instead we restrict the template to only expand into files understood to contain html.

Create a Custom folder

Right click in the template tree and choose “New Root Category”
Name the Folder “Custom”
We always recommend creating your new templates within a top-level folder of your own (typically called ‘Custom’). The main reason for doing this is for organisational purposes. By placing your templates under a single top level folder, you can export them as a group.

Read more: Rory Becker's DevExpress Blog

Posted via email from .NET Info

0 comments: