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?
问问题
2366 次
2 回答
3
不要将渲染的 SASS 文件的输出设置为 ,而是将输出/_site/css
设置为 just /css
(the site root level)。
正在发生的事情是本地 SASS 运行得很好,并/_site/
按照您的预期输出到您的目录中。但是在 GitHub 页面上的生产中(不支持 jekyll-compass gem),您的 CSS 根本不会被输出/_site
,因为插件没有在那里执行。
它在本地工作并不重要,因为 GitHub Pages 会在jekyll build
您推送并重新生成后再次运行该命令/_site/
。因此,它不支持的任何内容(即 jekyll-compass)都不会进入您/_site
文件夹的生产版本。
我建议的解决方法有效,因为不是将最终的 CSS 输出到在您推送到 GitHub 页面时会被覆盖的目录中,而是将其写入到即使使用新构建的目录也会保留的/_site/
目录。
另外值得注意的是,Jekyll 2.0 将支持 SASS,如果需要,您甚至可以在本地使用2.0 alpha gem(尽管 GH Pages 在正式发布之前不会更新到 2.0)。
于 2014-04-23T14:09:09.653 回答
1
GitHub 页面支持的插件很少,以前没有,但现在有 3 个。请参阅此页面了解更多信息。
您将需要编译 SASS 并提交生成的 CSS 文件。
于 2014-04-23T11:48:49.317 回答