Speedier coding by using Code Snippets in Microsoft Expression Web 2

A code snippet is a piece of code which is reusable. Microsoft Expression Web 2 has some preloaded code snippets for your use, but you can create your own snippets too. Code snippets save you a lot of time in coding and prevent typing errors as well. So whenever you want to repeat a piece of code, for instance the header of a page to multiple pages, you can create a code snippet and add it to your pages.

Insert a code snippet into a webpage

1.  In Code View, place your cursor where you want to insert the code snippet.

2.  To activate the Code Snippet menu, do one of the following:

  • Press CTRL + Enter.
  • Click List Code Snippets on the Code View toolbar.

list_code_snip_menu        

3. Start typing the keyword or scroll through the list to find the snippet you want to insert and hit the enter key or tab key or just double click your left mouse key.

Customize Code Snippets

To add, modify or delete any code snippet, do either of the following:

1.  Double-click on Customize list… option in the List Code Snippets menu. This would launch the Code Snippets tab on Page Editor Options dialog box.

2.  Go to Tools menu, select Page Editor Options and switch to Code Snippets tab. See image below:

page_ed_code_snip 

Click on Add to add a new code snippet. The Add Code Snippet dialog box is prompted as shown below:

 add_code_snip

Enter the keyword for the snippet and a description to help you identify what that snippet does. Then type in the code in the text area. The Modify Code Snippet dialog box is alike, only difference being, it is populated with the code and details for the code snippet that is chosen for modification.

Filed Under: Expression Web

Tags:

About the Author: Minal is a freelance web and graphics designer. She specializes in designing Logos, Stationery, Graphics and Icons as well as website templates using graphical tools like Photoshop, Illustrator and Expression Web. Twitter @saffronstroke

RSSComments (1)

Leave a Reply | Trackback URL

  1. Paul Liles says:

    Where is the snippet file on the PC… I have many of them and I do NOT want to lose them when I upgrade to 3.0

Leave a Reply