Last active
November 11, 2019 15:43
-
-
Save joemaller/3e5fe966b32c8ff6a17e7687172fd4cd to your computer and use it in GitHub Desktop.
Wrap templates in HTML comments which include the filepath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// In VS Code, choose "Preferences: Configure User Snippets" from the Command Palette, | |
// then choose "New Global Snippets file..." and add this. It's preset to trim file | |
// paths from "template-parts" or "_includes". | |
// | |
// To trigger the snippet, first select the text to be wrapped, choose "Insert Snippet" | |
// from the Command Palette, then select "Template Start/Stop Comments". | |
{ | |
"Template Start/Stop Comments": { | |
"scope": "php,html", | |
"prefix": "Template Comments Wrap", | |
"body": [ | |
"<!-- START ${1:${TM_FILEPATH/.*((?:template-parts|_includes)\\/.*)$/$1/}} -->", | |
"", | |
"$TM_SELECTED_TEXT", | |
"", | |
"<!-- END ${1} -->" | |
], | |
"description": "Wrap a template in START/END comments" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment