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

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


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


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.

Tags:

Sass

Jekyll