使用 Jekyll 和 Sass 找不到或无法读取要导入的文件

File to import not found or unreadable with Jekyll and Sass

我正在尝试 link 到我通过节点下载的 sass 库。

我遇到的错误:

Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/styles.scss':
   Error: File to import not found or unreadable: @library/path/src/index.scss. on line 3:1
   of @library/path/src/index.scss from line 3:1 of _sass/styles.scss from line 1:1
   of styles.scss >> @import '@library/path/src/index'; ^ 
                    ------------------------------------------------
      Jekyll 4.0.0   Please append `--trace` to the `serve` command 
                     for any additional information or backtrace. 

我的 sass 文件如下所示:

@import '@library/path/src/index';

我添加到我的 package.json 文件中:

"sass": {
    "includePaths": ["./node_modules"]
}

图书馆给出的我遗漏的唯一提示是 First, make sure your build system is configured so that the node_modules directory is in the list of Sass includePaths. 我不确定在哪里可以确认这一点。

注意:即使我 link 直接访问 node_modules

中的文件,这也不起作用
../node_modules/@library/path/src/index.scss

我想通了!

我必须添加到我的 config.yml

  load_paths:
    - _sass
    - node_modules