【发布时间】:2018-12-10 03:25:02
【问题描述】:
我遇到了一个与https://github.com/sass/dart-sass/issues/284 中报告的问题相似的问题,但对我来说似乎没有“修复”。我正在尝试按照https://getbootstrap.com/docs/4.1/getting-started/theming/ 中描述的工作流程来导入 Bootstrap 的 SCSS 源代码。
这是我的(简化的)目录结构:
.
├── index.html
├── node_modules
│ ├── @mdi
│ └── bootstrap
├── package-lock.json
├── package.json
├── scss
│ └── peek-solutions2.scss
└── stylesheets
└── peek-solutions.css
我已经使用 npm install bootstrap 安装了 Bootstrap;我的package.json 包含以下依赖项:
{
"dependencies": {
"@mdi/font": "^2.2.43",
"bootstrap": "^4.1.1"
}
}
在peek-solutions2.scss 中,我添加了以下行:
@import "../node_modules/bootstrap/scss/bootstrap";
我已尝试使用sass --watch 命令指定不同目录中的输入和输出文件(参见https://sass-lang.com/guide),但遇到了导入错误:
Kurts-MacBook-Pro:peek-solutions2 kurtpeek$ sass --watch scss/peek-solutions2.scss:stylesheets/peek-solutions2.css
Error: Can't find stylesheet to import.
@import "functions";
^^^^^^^^^^^
../node_modules/bootstrap/scss/bootstrap.scss 8:9 @import
scss/peek-solutions2.scss 1:9 root stylesheet
Sass is watching for changes. Press Ctrl-C to stop.
这似乎是一个路径问题; _functions.scss 与node_modules/bootstrap/scss 中的bootstrap.scss 位于同一目录中,但似乎sass 命令希望它位于我的自定义scss 目录中。我该如何解决这个问题?
【问题讨论】: