使用html5 模版时使用 ! + Tab 十分好用,美中不足需要每次重新修改lang,引入css、js。使用下面方法可以创建自己的模版
vscode - 左下角齿轮 - 【用户代码片段】,搜索“html.json”,在{}中输入自己的模版
"Bootstrap":{
"prefix": "b", #快捷键 类似 !+Tab 中的 !
"body": [ #模版内容,每一行是一段字符串
"<!DOCTYPE html>",
"<html lang=\"zh-CN\">",
"\t<head>",
"\t\t<meta charset=\"utf-8\">", #引号用\转译
"\t\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">",
"\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">",
"\t\t<title>Document</title>",
"\t\t<link href=\"\" rel=\"stylesheet\">",
"\t\t<!-- [if lt IE 9] ->",
"\t\t<script src=\"https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js\"></script>",
"\t\t<script src=\"https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js\"></script>",
"\t\t<!- [endif]-->",
"\t</head>",
"\t<body>",
"\t\t<script type=\"text/javascript\">",
"\t\t$1", #$1的位置是创建模版后光标的位置
"\t\t</script>",
"\t</body>",
"</html>",
],
"description": "By unXeer 2020-4-22" #描述信息
}
以上 希望对大家有帮助