Module: Bootstrap::BookingSync

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

Defined Under Namespace

Modules: Rails

Constant Summary collapse

VERSION =
"3.0.0"

Class Method Summary collapse

Class Method Details

.assets_pathObject



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

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

.compass?Boolean

Returns:

  • (Boolean)


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

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

.fonts_pathObject



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

def fonts_path
  File.join assets_path, 'fonts'
end

.gem_pathObject

Paths



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

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

.javascripts_pathObject



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

def javascripts_path
  File.join assets_path, 'javascripts'
end

.load!Object

Inspired by Kaminari



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

def load!
  register_compass_extension if compass?

  if rails?
    register_rails_engine
  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::Number.precision = [6, ::Sass::Script::Number.precision].max
  end
end

.rails?Boolean

Returns:

  • (Boolean)


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

def rails?
  defined?(::Rails)
end

.sprockets?Boolean

Environment detection helpers

Returns:

  • (Boolean)


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

def sprockets?
  defined?(::Sprockets)
end

.stylesheets_pathObject



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

def stylesheets_path
  File.join assets_path, 'stylesheets'
end