简体   繁体   English

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

[英]Jeykll file to import not found or unreadable: base

Ok, so, I somehow managed to break my jekyll website and I don't understand why.好的,所以,我以某种方式设法破坏了我的 jekyll 网站,但我不明白为什么。 When I try to serve the site with jekyll I am prompted the following error:当我尝试使用 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

   ^

My directory structure looks like so:我的目录结构如下所示:

.
├── 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

I assume it has trouble finding the _base.scss file?我认为它很难找到 _base.scss 文件? How can I tell it where it needs to look?我怎样才能告诉它它需要看哪里? It is pointing out the error is in line 24, but that doesn't really makes much sense.它指出错误在第 24 行,但这并没有多大意义。 My main.scss looks like so:我的 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"
;

Can someone point out how I can fix this problem?有人能指出我如何解决这个问题吗?

Your project directory structure looks a little odd, since you use the unconventional organisation within the src folder.您的项目目录结构看起来有点奇怪,因为您在src文件夹中使用了非常规的组织。

I see 2 simple solutions:我看到 2 个简单的解决方案:

1. Move the contents out of the src folder into the root 1.将src文件夹中的内容移出到根目录

That is the expected structure and you don't run into further configuration issues.这是预期的结构,您不会遇到进一步的配置问题。 It will just work because everything is where it is supposed to be.它会起作用,因为一切都在它应该在的地方。

2. Configure sass in _config.yml 2.在_config.yml中配置sass

In your _config.yml add the following sections:在您的_config.yml添加以下部分:

sass:
  sass_dir: src/_sass

and the jekyll-sass-converter should be able to find it.并且jekyll-sass-converter应该能够找到它。 Have a look at the Jekyll Assets Docs for further information.查看Jekyll 资产文档以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM