由于 Jekyll 原生支持 sass,您可以使用 bootstrap-sass。
我个人使用bower install bootstrap-sass 命令安装它。
这会将 Bootstrap 和 Jquery 安装到 bower_components 文件夹中。
配置
在你的 _config.yml 添加:
sass:
# loading path from site root
# default to _sass
sass_dir: bower_components/bootstrap-sass/assets/stylesheets
# style : nested (default), compact, compressed, expanded
# :nested, :compact, :compressed, :expanded also works
# see http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style
# on a typical twitter bootstrap stats are :
# nested 138,7kB, compact 129,1kB, expanded 135,9 kB, compressed 122,4 kB
style: compressed
Javascript
如果你想使用 javascript,在你的 _includes/footer.html 添加:
<script src="{{ site.baseurl }}/bower_components/jquery/dist/jquery.min.js"></script>
<script src="{{ site.baseurl }}/bower_components/bootstrap-sass/assets/javascripts/bootstrap.min.js"></script>
使用
在css/main.scss删除之前的内容并添加
---
# Only the main Sass file needs front matter (the dashes are enough)
---
@charset "utf-8";
/* path to glyphicons */
$icon-font-path: "/bower_components/bootstrap-sass/assets/fonts/bootstrap/";
/* custom variable */
$body-bg: red;
/* any style customization must be before the bootstrap import */
@import "bootstrap";
您可以在bower_components/bootstrap-sass/assets/stylesheets/bootstrap/_variables.scss中看到所有可用的变量
您可以删除旧的 _sass 文件夹。
现在您的 css 文件会在每次构建时生成。