module ConversationForms

Constants

VERSION

Public Class Methods

assets_path() click to toggle source
# File lib/conversation_forms.rb, line 30
def assets_path
  @assets_path ||= File.join gem_path, 'assets'
end
compass?() click to toggle source
# File lib/conversation_forms.rb, line 39
def compass?
  defined?(::Compass::Frameworks)
end
gem_path() click to toggle source

Paths

# File lib/conversation_forms.rb, line 18
def gem_path
  @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
end
javascripts_path() click to toggle source
# File lib/conversation_forms.rb, line 26
def javascripts_path
  File.join assets_path, 'javascripts'
end
load!() click to toggle source

Inspired by Kaminari through bootstrap-sass

# File lib/conversation_forms.rb, line 5
def load!
  register_compass_extension if compass?

  if rails?
    register_rails_engine
  elsif sprockets?
    register_sprockets
  end

  configure_sass
end
rails?() click to toggle source
# File lib/conversation_forms.rb, line 43
def rails?
  defined?(::Rails)
end
sprockets?() click to toggle source

Environment detection helpers

# File lib/conversation_forms.rb, line 35
def sprockets?
  defined?(::Sprockets)
end
stylesheets_path() click to toggle source
# File lib/conversation_forms.rb, line 22
def stylesheets_path
  File.join assets_path, 'stylesheets'
end

Private Class Methods

configure_sass() click to toggle source
# File lib/conversation_forms.rb, line 49
def configure_sass
  require 'sass'

  ::Sass.load_paths << stylesheets_path

  # bootstrap requires minimum precision of 8, see https://github.com/twbs/conversation_forms/issues/409
  ::Sass::Script::Number.precision = [8, ::Sass::Script::Number.precision].max
end
register_compass_extension() click to toggle source
# File lib/conversation_forms.rb, line 58
def register_compass_extension
  ::Compass::Frameworks.register(
      'conversation_forms',
      :version               => ConversationForms::VERSION,
      :path                  => gem_path,
      :stylesheets_directory => stylesheets_path,
      :templates_directory   => File.join(gem_path, 'templates')
  )
end
register_rails_engine() click to toggle source
# File lib/conversation_forms.rb, line 68
def register_rails_engine
  require 'conversation_forms/engine'
end
register_sprockets() click to toggle source
# File lib/conversation_forms.rb, line 72
def register_sprockets
  Sprockets.append_path(stylesheets_path)
  Sprockets.append_path(javascripts_path)
end