Jekyll doesn't compile scss files with `jekyll serve`

后端 未结 4 732
我寻月下人不归
我寻月下人不归 2021-02-15 14:10

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

I\'ve updated my css/main.scss in order to in

相关标签:
4条回答
  • 2021-02-15 15:01

    I've run into similar issues when trying to use Jekyll to pass YAML content into partials. It looks like this workflow is not possible.

    The work around was to place all variables on the main SCSS file and get Jekyll to populate the values from YAML, then using partials for the actual styles.

    Here's a simple repo with some of my solutions: https://github.com/guschiavon/jekyllfy-sass

    0 讨论(0)
  • 2021-02-15 15:10

    First add to your config.yml

    sass:
        sass_dir: _sass
    

    Then add to top in your main.scss file, two dashed lines https://jekyllrb.com/docs/assets/

    ---
    ---
    
    @charset "utf-8";
    

    After that write in your cmd console

    jekyll serve

    and check your compilation.

    0 讨论(0)
  • 2021-02-15 15:14

    Have you added the front matter to the top of your main.scss file?

    0 讨论(0)
  • 2021-02-15 15:17

    Ok, I get it !

    You have a css/main.css files that is copied as a static file in _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 is processed to main.css
    • then, when static files are copied, it is overridden by css/main.css.

    Solution : delete css/main.css

    0 讨论(0)
提交回复
热议问题