Module: Bootstrap::Scss

Defined in:
lib/bootstrap/scss.rb,
lib/bootstrap/scss/engine.rb,
lib/bootstrap/scss/version.rb

Defined Under Namespace

Classes: Engine

Constant Summary collapse

GEM_PATH =
File.expand_path '..', File.dirname(__FILE__)
ASSETS_PATH =
File.join GEM_PATH, 'vendor', 'assets'
VERSION =

We won’t adopt bootstrap versions until we figure this gem out

'0.0.3'

Class Method Summary collapse

Class Method Details

.hanami?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/bootstrap/scss.rb', line 39

def hanami?
  defined?(::Hanami)
end

.load!Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bootstrap/scss.rb', line 11

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 << ASSETS_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

Returns:

  • (Boolean)


35
36
37
# File 'lib/bootstrap/scss.rb', line 35

def rails?
  defined?(::Rails)
end

.sprockets?Boolean

Environment detection helpers

Returns:

  • (Boolean)


31
32
33
# File 'lib/bootstrap/scss.rb', line 31

def sprockets?
  defined?(::Sprockets)
end