Module: Bootstrap
- Defined in:
- lib/bootstrap.rb,
lib/bootstrap/engine.rb,
lib/bootstrap/version.rb
Defined Under Namespace
Modules: Rails
Constant Summary collapse
- VERSION =
'4.5.3'
- BOOTSTRAP_SHA =
'a716fb03f965dc0846df479e14388b1b4b93d7ce'
Class Method Summary collapse
- .assets_path ⇒ Object
-
.gem_path ⇒ Object
Paths.
- .hanami? ⇒ Boolean
- .javascripts_path ⇒ Object
-
.load! ⇒ Object
Inspired by Kaminari.
- .rails? ⇒ Boolean
-
.sprockets? ⇒ Boolean
Environment detection helpers.
- .stylesheets_path ⇒ Object
Class Method Details
.assets_path ⇒ Object
41 42 43 |
# File 'lib/bootstrap.rb', line 41 def assets_path @assets_path ||= File.join gem_path, 'assets' end |
.gem_path ⇒ Object
Paths
29 30 31 |
# File 'lib/bootstrap.rb', line 29 def gem_path @gem_path ||= File. '..', File.dirname(__FILE__) end |
.hanami? ⇒ Boolean
54 55 56 |
# File 'lib/bootstrap.rb', line 54 def hanami? defined?(::Hanami) end |
.javascripts_path ⇒ Object
37 38 39 |
# File 'lib/bootstrap.rb', line 37 def javascripts_path File.join assets_path, 'javascripts' end |
.load! ⇒ Object
Inspired by Kaminari
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bootstrap.rb', line 9 def load! if rails? register_rails_engine elsif hanami? register_hanami elsif sprockets? register_sprockets elsif defined?(::Sass) && ::Sass.respond_to?(:load_paths) # The deprecated `sass` gem: ::Sass.load_paths << stylesheets_path end if defined?(::Sass::Script::Value::Number) # Set precision to 6 as per: # https://github.com/twbs/bootstrap/blob/da717b03e6e72d7a61c007acb9223b9626ae5ee5/package.json#L28 ::Sass::Script::Value::Number.precision = [6, ::Sass::Script::Value::Number.precision].max end end |
.rails? ⇒ Boolean
50 51 52 |
# File 'lib/bootstrap.rb', line 50 def rails? defined?(::Rails) end |
.sprockets? ⇒ Boolean
Environment detection helpers
46 47 48 |
# File 'lib/bootstrap.rb', line 46 def sprockets? defined?(::Sprockets) end |
.stylesheets_path ⇒ Object
33 34 35 |
# File 'lib/bootstrap.rb', line 33 def stylesheets_path File.join assets_path, 'stylesheets' end |