Adding Bootstrap to Jekyll -
i'm new jekyll , pull in of twitter bootstrap functionality. has done and, if so, have advice? have gone jekyll-bootstrap, there no longer support it. have built jekyll site , hoping there's way pull in bootstrap.
as jekyll natively supports sass, can use bootstrap-sass.
i install bower install bootstrap-sass
command.
this installs bootstrap , jquery in bower_components
folder.
configuration
in _config.yml add :
sass: # loading path site root # default _sass sass_dir: bower_components/bootstrap-sass/assets/stylesheets # style : nested (default), compact, compressed, expanded # :nested, :compact, :compressed, :expanded works # see http://sass-lang.com/documentation/file.sass_reference.html#output_style # on typical twitter bootstrap stats : # nested 138,7kb, compact 129,1kb, expanded 135,9 kb, compressed 122,4 kb style: compressed
javascript
if want use javascript, in _includes/footer.html add :
<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>
use
in css/main.scss
delete previous content , add
--- # main sass file needs front matter (the dashes enough) --- @charset "utf-8"; /* path glyphicons */ $icon-font-path: "/bower_components/bootstrap-sass/assets/fonts/bootstrap/"; /* custom variable */ $body-bg: red; /* style customization must before bootstrap import */ @import "bootstrap";
you can see variables available in bower_components/bootstrap-sass/assets/stylesheets/bootstrap/_variables.scss
you can remove old _sass folder.
now css file generated @ each build.
Comments
Post a Comment