Module: Bootstrap

Defined in:
lib/bootstrap-sass.rb,
lib/bootstrap-sass/engine.rb,
lib/bootstrap-sass/version.rb

Defined Under Namespace

Modules: Rails

Constant Summary collapse

VERSION =
'3.4.1'
BOOTSTRAP_SHA =
'68b0d231a13201eb14acd3dc84e51543d16e5f7e'

Class Method Summary collapse

Class Method Details

.assets_pathObject



42
43
44
# File 'lib/bootstrap-sass.rb', line 42

def assets_path
  @assets_path ||= File.join gem_path, 'assets'
end

.compass?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/bootstrap-sass.rb', line 51

def compass?
  defined?(::Compass::Frameworks)
end

.fonts_pathObject



34
35
36
# File 'lib/bootstrap-sass.rb', line 34

def fonts_path
  File.join assets_path, 'fonts'
end

.gem_pathObject

Paths



26
27
28
# File 'lib/bootstrap-sass.rb', line 26

def gem_path
  @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
end

.hanami?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/bootstrap-sass.rb', line 59

def hanami?
  defined?(::Hanami)
end

.javascripts_pathObject



38
39
40
# File 'lib/bootstrap-sass.rb', line 38

def javascripts_path
  File.join assets_path, 'javascripts'
end

.load!Object

Inspired by Kaminari



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bootstrap-sass.rb', line 5

def load!
  register_compass_extension if compass?

  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)
    # bootstrap requires minimum precision of 8, see https://github.com/twbs/bootstrap-sass/issues/409
    ::Sass::Script::Value::Number.precision = [8, ::Sass::Script::Value::Number.precision].max
  end
end

.rails?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/bootstrap-sass.rb', line 55

def rails?
  defined?(::Rails)
end

.sprockets?Boolean

Environment detection helpers

Returns:

  • (Boolean)


47
48
49
# File 'lib/bootstrap-sass.rb', line 47

def sprockets?
  defined?(::Sprockets)
end

.stylesheets_pathObject



30
31
32
# File 'lib/bootstrap-sass.rb', line 30

def stylesheets_path
  File.join assets_path, 'stylesheets'
end