找不到要导入的Jeykll文件或无法读取:基本

时间:2020-07-24 03:21:48

标签: css web sass jekyll

好的,所以我设法以某种方式破坏了我的jekyll网站,但我不明白为什么。当我尝试使用jekyll为网站提供服务时,系统提示以下错误:

/usr/lib/ruby/gems/2.7.0/gems/jekyll-sass-converter-2.1.0/lib/jekyll/converters/scss.rb:190:in `rescue in convert': Error: File to import not found or unreadable: base. (Jekyll::Converters::Scss::SyntaxError)
        on line 24:1 of main.scss
>> @import

   ^

我的目录结构如下:

.
├── README.md
├── _site
│   ├── README.md
│   └── src
│       ├── assets
│       │   ├── posts
│       │   │   └── 202-07-23-about
│       │   │       └── avatar.png
│       │   └── screenshot.png
│       ├── general
│       │   └── 2020
│       │       └── 07
│       │           └── 23
│       │               └── about.html
│       └── index.html
└── src
    ├── assets
    │   ├── images
    │   ├── posts
    │   │   └── 202-07-23-about
    │   │       └── avatar.png
    │   └── screenshot.png
    ├── _config.yml
    ├── css
    │   └── main.scss
    ├── _includes
    │   ├── footer.html
    │   └── head.html
    ├── index.html
    ├── _layouts
    │   ├── default.html
    │   ├── page.html
    │   └── post.html
    ├── _posts
    │   └── 2020-07-23-about.md
    ├── _sass
    │   ├── _base.scss
    │   └── _syntax-highlighting.scss
    └── _templates
        ├── draft
        ├── page
        └── post

我认为查找_base.scss文件有麻烦吗?我如何告诉它需要看什么?它指出该错误在第24行,但这实际上没有多大意义。我的main.scss看起来像这样:

---
# Only the main Sass file needs front matter (the dashes are enough)
---
@charset "utf-8";

// Our variables
$base-font-family: 'PT Serif', Georgia, Times, 'Times New Roman', serif;
$base-font-size:   12pt;
$small-font-size:  $base-font-size * 0.875;
$base-line-height: 1.5;

$mono-font-family: 'Source Code Pro', Menlo, Monaco, Inconsolata;

$text-color:       hsl(0, 0%, 25%);

$alt-color:        hsl(0, 70%, 46%);
$alt-color-darker: darken($alt-color, 6%);

$article-bg-color: hsl(35, 36%, 95%);
$background-color: darken($article-bg-color, 6%);
$bg-color-darker:  darken($article-bg-color, 15%);
$alt-text-color:   darken($article-bg-color, 60%);

$subdued-border:   rgba($bg-color-darker, 0.5);

// Import partials from `sass_dir` (defaults to `_sass`)
@import
  "base",
  "syntax-highlighting"
;

有人可以指出我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

您的项目目录结构看起来有些奇怪,因为您使用src文件夹中的非常规组织。

我看到2个简单的解决方案:

1。将内容从src文件夹移至根目录

这是预期的结构,您不会遇到其他配置问题。它将起作用,因为一切都应该在原处。

2。在_config.yml

中配置sass

在您的_config.yml中添加以下部分:

sass:
  sass_dir: src/_sass

jekyll-sass-converter应该可以找到它。 请查看Jekyll Assets Docs以获得更多信息。