I was building my site with css and everything was working fine, both locally and remotely. Then I wanted to switch to sass. I installed jekyll-compass and now my sass files are being output as css files in my _site/css folder. Everything works well locally, but when I push them to Github, my styles are not being applied and I get a 404 on that css file. What am I doing wrong?
2 Answers
Instead of setting the output of your rendered SASS files to /_site/css
, set the output to just /css
(the site root level).
What is happening is that locally SASS is running just fine and outputting into your /_site/
directory as you'd expect. But in production on GitHub pages (where the jekyll-compass gem isn't supported) your CSS isn't being output into /_site
at all because the plugin isn't being executed there.
It doesn't matter that it works locally from there because GitHub Pages runs the jekyll build
command again once you push and generates /_site/
afresh. So anything it doesn't support (i.e. jekyll-compass) doesn't make it into the production version of your /_site
folder.
The workaround I've suggested works because instead of outputting the final CSS into a directory that gets overwritten when you push to GitHub pages, it will instead write it to a directory that is preserved even with a fresh build of the /_site/
directory.
Also of note, Jekyll 2.0 will support SASS, and you can even use the 2.0 alpha gem locally if you want (although GH Pages won't be updated to 2.0 until it's officially released).

- 7,469
- 9
- 51
- 86
-
1Thanks for explaining. How do you change the SASS output destination within Jekyll? – user1113828 Sep 23 '14 at 03:43
-
Note that GitHub Pages has been upgraded to Jekyll 2.0 and will work as expected with Sass now. – Joel Glovier Sep 23 '14 at 16:04
Very few plugins are supported by GitHub pages, it used to be none but now there are three. See this page for more information.
You will need to compile the SASS and commit the generated CSS files.

- 2,343
- 2
- 19
- 24