Visual Studio代码-巨大的片段

时间:2018-08-03 15:24:53

标签: visual-studio-code bootstrap-4 code-snippets

我有一个小问题。我想在Visual Studio代码中制作一些巨大的代码段,但我没有时间用逗号分隔每一行并将其用双引号引起来,我的代码段看起来像这样

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">

  <!-- ALL CSS STYLESHEETS / FRAMEWORKS OVER HERE -->

  <!-- FONTAWESOME V5.2.0-->
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ"
    crossorigin="anonymous">
  <!-- BOOTSTRAP FRAMEWORK V4.1.3-->
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
    crossorigin="anonymous">
  <!-- CUSTOM CSS-->
  <link rel="stylesheet" href="css/style.css">
  <title>First Bootstrap Project</title>
</head>

<body>
  <!-- ########## START HERE ########## -->

  <!-- Jquery 3.3.1 min-->
  <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
    crossorigin="anonymous"></script>
  <!-- Popper 1.14.3 min-->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
    crossorigin="anonymous"></script>
  <!-- Bootstrap min-->
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
    crossorigin="anonymous"></script>

  <!-- CUSTOM JAVASCRIPT HERE-->
  <script>
    $('year').text(new Date().getFullYear());
  </script>
</body>

</html>

因此,我很想解决这个问题

1 个答案:

答案 0 :(得分:1)

请参见snippet generator app。很漂亮产生:

"": {
  "prefix": "",
  "body": [
    "<html lang=\"en\">",
    "",
    "<head>",
    "  <meta charset=\"UTF-8\">",
    "  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
    "  <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">",
    "",
    "  <!-- ALL CSS STYLESHEETS / FRAMEWORKS OVER HERE -->",
    "",
    "  <!-- FONTAWESOME V5.2.0-->",
    "  <link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.2.0/css/all.css\" integrity=\"sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ\"",
    "    crossorigin=\"anonymous\">",
    "  <!-- BOOTSTRAP FRAMEWORK V4.1.3-->",
    "  <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\" integrity=\"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO\"",
    "    crossorigin=\"anonymous\">",
    "  <!-- CUSTOM CSS-->",
    "  <link rel=\"stylesheet\" href=\"css/style.css\">",
    "  <title>First Bootstrap Project</title>",
    "</head>",
    "",
    "<body>",
    "  <!-- ########## START HERE ########## -->",
    "",
    "  <!-- Jquery 3.3.1 min-->",
    "  <script src=\"https://code.jquery.com/jquery-3.3.1.min.js\" integrity=\"sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=\"",
    "    crossorigin=\"anonymous\"></script>",
    "  <!-- Popper 1.14.3 min-->",
    "  <script src=\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js\" integrity=\"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49\"",
    "    crossorigin=\"anonymous\"></script>",
    "  <!-- Bootstrap min-->",
    "  <script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js\" integrity=\"sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy\"",
    "    crossorigin=\"anonymous\"></script>",
    "",
    "  <!-- CUSTOM JAVASCRIPT HERE-->",
    "  <script>",
    "    $('year').text(new Date().getFullYear());",
    "  </script>",
    "</body>",
    "",
    "</html>"
  ],
  "description": ""
}