当 Vue-CLI 3 创建项目时,会创建一个 public/index.html。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Website</title>
</head>
<body>
<noscript>
<strong>We're sorry but the website doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
我想在头部添加一个外部 CSS 文件,但源文件在 SASS/SCSS 中。我想要这个文件的原因是围绕 Vue 应用程序 ( <div id="app">/<div>
) 设置标记样式,就像<body>
元素一样。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Website</title>
<link href="[I want to reference a compiled SCSS file here]" rel="stylesheet" type="text/css" />
</head>
<body>
<noscript>
<strong>We're sorry but the website doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
我阅读了关于 CSS 的 Vue-CLI 3 指南https://cli.vuejs.org/guide/css.html,但我的印象是该页面上的建议是将 SASS 集成到单文件组件中(* .vue 文件),例如允许单个文件组件访问全局 SASS 变量。我能否获得 Vue-CLI 3 构建过程来编译与任何 *.vue 文件不直接相关但仍是 Vue 应用程序的一部分以用于部署目的的 SASS 文件?