Sass, getting Error: Can't find stylesheet to import

Sass, getting Error: Can't find stylesheet to import

文件夹结构:

错误描述:

Sass版本:

ParcelJS 能够将我的 Sass/Scss 代码编译成纯 CSS 解决了我的问题,但我不想在像这样的小项目中使用它。

OS: MX Linux.

编辑:如果我不使用“@use”或“@import”,Sass 能够很好地编译我的代码

尝试使用相对路径像这样导入:

@use abstracts/resets

您可以阅读更多 here 官方文档,这里是 Sass 如何导入文件的概述:

Finding the File

It wouldn’t be any fun to write out absolute URLs for every stylesheet you import, so Sass’s algorithm for finding a file to import makes it a little easier. For starters, you don’t have to explicitly write out the extension of the file you want to import; @import "variables" will automatically load variables.scss, variables.sass, or variables.css.

⚠️ Heads up

To ensure that stylesheets work on every operating system, Sass imports files by URL, not by file path. This means you need to use forward slashes, not backslashes, even when you’re on Windows.

Load Paths

All Sass implementations allow users to provide load paths: paths on the filesystem that Sass will look in when resolving imports. For example, if you pass node_modules/susy/sass as a load path, you can use @import "susy" to load node_modules/susy/sass/susy.scss.

Imports will always be resolved relative to the current file first, though. Load paths will only be used if no relative file exists that matches the import. This ensures that you can’t accidentally mess up your relative imports when you add a new library.

Fun fact:

Unlike some other languages, Sass doesn’t require that you use ./ for relative imports. Relative imports are always available.