No commit activity in last 3 years
No release in over 3 years
Display a colored grid size indicator when using bootstrap-sass with Rails. Display a colored grid size indicator at the top of the page. The colors correspond to the bootstrap breakpoints.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 10.0
~> 3.0

Runtime

~> 8.2
~> 4.2
 Project Readme

GridSizeDisplay

If you are using Rails and the bootstrap-sass gem, display a visual indicator to let you know what bootstrap grid size you are using. This gem uses the default bootstrap variables names to determine grid sizes. The gem works even if you've overwritten the default values of the variables.

From the Bootstrap3 documentation:

@media (max-width: @screen-xs-max) { ... }
@media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) { ... }
@media (min-width: @screen-md-min) and (max-width: @screen-md-max) { ... }
@media (min-width: @screen-lg-min) { ... }
  • col-xs-* = Red
  • col-sm-* = Orange
  • col-md-* = Yellow
  • col-lg-* = Green

Current Version

  • v1.0.0

Installation

Add this line to your applications Rails + bootstrap-sass enabled application Gemfile:

gem 'gem_size_display'

And then execute:

$ bundle

Include the Sass partial to your application.scss file. Be sure to include it after bootstrap.

// app/assets/stylesheets/application.scss
...
@import "bootstrap-sprockets";
@import "bootstrap";
@import "grid_size_display/media_sizes";

Configuration

The gem is enabled by default if you are in development environment. You can add an initializer to control when to enable the gem:

# config/initializers/grid_size_display.rb

GridSizeDisplay.configure do |config|
  # config.enabled = false
  # config.enabled = Rails.env.development?
end

Special query strings

By default the visual indicator will be displayed on every request. If you include the query string grid_size_display=disable at the end of your request you will disable the display for your session. To re-enable just add the query string grid_size_display=enable.