We want to write a snippet in VS Code so that we can create HTML pages from our template.
How to create the snippet
- Go to "Code > Settings"
- Select "Configure Snippets"
- Select "HTML"
- Convert the existing HTML template into a VS Code snippet using snippet generator
- Check the prefixes, description and variables are correct
- Update your user preferences:
"editor.tabCompletion": "on"
- NB To edit an existing snippet repeat the above and select "Existing Snippets"
How to use the snippet
- Create a new HTML page
- Start typing one of the new template prefixes e.g. pac-page and select a snippet e.g. "People & Code HTML Page"
- Replace the variables, meta description, title and page header, with values.
Tips
To access your "User preferences":
- Mac: ⌘ Shift + P / Windows: Ctrl Shift + P
- Type: "User Settings", short for "Preferences: Open User Settings (JSON)"
To navigate between items:
- Use the Tab key
To delete a project or global snippet:
- Mac: ⌘ Shift + P / Windows: Ctrl Shift + P
- Enter or select: "Snippets: Configure Snippets"
- Select the snippet to delete
- Right click on the snippet tab name
- Select "Reveal in Finder"
- Delete the snippet