Export (0) Print
Expand All

Create or modify a code snippet

When you have code that you often use, you can create a code snippet to quickly insert it. You can also modify or delete the code snippets that you've created or the code snippets that are provided by Microsoft Expression Web.

To create or modify a code snippet

  1. On the Panels menu, click Snippets.

  2. In the Snippets panel, do one of the following:

    • To create a code snippet, click Options and then click New Snippet.

    • To modify a code snippet, click the code snippet you want to edit, and then click Modify.

  3. In the New/Modify Code Snippet dialog box, do the following:

    Use this To do this

    Name

    Type a unique name for the code snippet that you can subsequently type to select the code snippet in the list of code snippets.

    Description

    Type a description to identify the code snippet.

    Type

    Choose how the snippet will be added to the code:

    • Select Insert/replace for a snippet that will be inserted at the cursor, replacing any selected text.

    • Select Wrap for a snippet that will be inserted around the selected text, leaving the selected text intact.

    Text

    Type the code that will be inserted when you select the code snippet.

    tip noteTip
    If your code snippet contains text that must be updated, place "pipe" (|) characters before and after the text to be replaced. In the Code view, that text is highlighted.

    Code before

    Type the code that will be inserted before the selected text.

    Code before

    Type the code that will be inserted at the end of the selected text.

To delete a code snippet

  1. On the Panels menu, click Snippets.

  2. In the Snippets panel, select the snippet to be deleted.

  3. Click Options and then click Delete.

To manage code snippets

You can organize snippets by folder inside the Snippets panel.

  1. On the Panels menu, click Snippets.

  2. To add a new folder, click Options and then click New Folder. To delete a folder, select the folder you want to delete, click Options, and then click Delete.

  3. Drag and drop individual snippets to organize them according to your needs.

See also

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2014 Microsoft