Skip to content

bootstrap-ruby/middleman-bootstrap-navbar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

9508887 · Feb 13, 2025

History

87 Commits
Aug 21, 2016
Apr 24, 2016
Jan 11, 2017
Oct 22, 2017
Apr 24, 2016
Mar 31, 2017
Jan 11, 2017
May 28, 2013
May 28, 2013
Feb 13, 2025
Apr 24, 2016
Oct 22, 2017

Repository files navigation

Middleman Bootstrap Navbar

Gem Version Build Status Code Climate

Middleman extension to easily generate a Bootstrap navbar

Installation

Add this line to your application's Gemfile:

gem 'middleman-bootstrap-navbar'

And then execute:

$ bundle

Or install it yourself as:

$ gem install middleman-bootstrap-navbar

Requirements

Middleman

Middleman >= 3.1

Bootstrap

Bootstrap >= 2.0

The necessary Bootstrap files have to be included separately, they are not part of this gem.

At least the CSS files for the navbar are required, and the JS files for dropdowns and responsive features, if you want to use those in the navbar.

Usage

Activate extension

Activate the extensions in config.rb in your Middleman app:

activate :bootstrap_navbar

Set Bootstrap version

This gem needs to know which Bootstrap version you are using, because the navbar HTML looks different in different Bootstrap versions.

If you're using either the bootstrap-sass or bootstrap gem, you're all set because the Boostrap version will be sniffed automatically from those gems' versions. Make sure to include the bootstrap-sass or bootstrap gem before rails_bootstrap_navbar in your Gemfile though.

However, if you include the Bootstrap CSS and JS some other way, you need to set the Bootstrap version before activating the extension:

# Only necessary if you don't use the `bootstrap-sass` or `bootstrap` gems.
::BootstrapNavbar.configure do |config|
  config.bootstrap_version = '4.0.0'
end

activate :bootstrap_navbar

Output HTML

The gem bootstrap-navbar is used to generate the HTML. Please refer to the gem's README and the following Wiki entries for detailed instructions on how to generate the navbar:

Usage with Bootstrap 2

Usage with Bootstrap 3

Usage with Bootstrap 4

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Support

If you like this project, consider buying me a coffee! :)