简体   繁体   中英

My jekyll site on github is not showing my sass (scss)

I locally made a jekyll site which works perfectly. Now that I uploaded it to github it suddenly doesn't use any scss of mine anymore. In my wrapper.html layout (which I use a layout for the other layouts) I have included:

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="{{ '/assets/css/main.css' | absolute_url }}" >

in assets/css/main.css is:

---
---
@import "stylesheet";

And _stylesheet.scss is in _sass/_stylesheet.scss. Let me know if more information is needed! What is going wrong here? Thanks in advance!

With Jekyll the two main problems for beginners are:

  1. how the theme works/where to find its files and
  2. how basurls/relative urls work.

This problem is clearly the latter. Github Pages requires a baseurl, so you cannot link to the domain root. Therefore the starting slash is incorrect. This should work:

<link rel="stylesheet" href="{{ '/assets/css/main.css' | prepend: site.baseurl }}" >

More info for Jekyll beginners can be found in this Jekyll Conference talk .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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