Jekyll不会使用`jekyll serve`来编译scss文件. [英] Jekyll doesn't compile scss files with `jekyll serve`

查看:60
本文介绍了Jekyll不会使用`jekyll serve`来编译scss文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Jekyll创建一个网站,并且一切正常.直到我想自定义设计.

I'm trying to create a website using Jekyll, and everything worked fine. Until I wanted to custom the design.

我已经更新了css/main.scss,以便将自定义主题包含在_sass/theme.scss中:

I've updated my css/main.scss in order to include my custom theme in _sass/theme.scss:

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

我还更新了_config.yml,因为jekyll serve -H 0.0.0.0没有编译我的新sass文件.我添加了以下内容:

I've also updated _config.yml, because jekyll serve -H 0.0.0.0 didn't compile my new sass file. I've added the following:

sass:
    sass_dir: _sass

问题是jekyll serve无法编译我的sass文件,我总是看到默认的CSS.我还尝试过直接在css/main.scss的末尾复制_sass/theme.scss的内容,但是什么也没发生.

The problem is jekyll serve doesn't compile my sass files, I always see the default css. I've also tried to copy the content of _sass/theme.scss directly at the end of css/main.scss, but nothing happened.

在运行jekyll serve之前,我修改了其中一个文件.问题是jekyll-watch理解我的更新并编译了scss文件.对于jekyll build第一次尝试不编译sass文件,我是否做错了什么?

Until I modified one of those files while jekyll serve was running. The thing is jekyll-watch understands my updates and compile the scss files. May I have done something wrong for jekyll build don't compile sass files at the first try?

如果您需要它,请在这里我的项目树:

In case you need it, here my project tree:

.
├── _config.yml
├── css
│   ├── main.css
│   └── main.scss
├── _images
├── img
├── index.html
└── _sass
    ├── _base.scss
    ├── _layout.scss
    ├── _syntax-highlighting.scss
    └── _theme.scss

有人知道如何解决此问题吗?

Does someone know how to fix this?

谢谢

推荐答案

好,我明白了!

您有一个css/main.css文件,已将其复制为_site/css/main.css中的静态文件.

You have a css/main.css files that is copied as a static file in _site/css/main.css.

问题在于它与css/main.scss目标(也是_site/css/main.css)具有相同的名称.

The problem is that it has the same name as the css/main.scss target which is also _site/css/main.css.

因此,在第一次构建时:

So at first build :

  • css/main.scss被处理为main.css
  • 然后,在复制静态文件时,它会被css/main.css覆盖.
  • css/main.scss is processed to main.css
  • then, when static files are copied, it is overridden by css/main.css.

解决方案:删除css/main.css

这篇关于Jekyll不会使用`jekyll serve`来编译scss文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆