module Mice

Mice.load!

Constants

VERSION

Public Class Methods

asset_pipeline?() click to toggle source

Environment detection helpers

# File lib/mice.rb, line 55
def asset_pipeline?
  defined?(::Sprockets)
end
assets_path() click to toggle source
# File lib/mice.rb, line 50
def assets_path
  @assets_path ||= File.join gem_path, 'assets'
end
compass?() click to toggle source
# File lib/mice.rb, line 59
def compass?
  defined?(::Compass)
end
fonts_path() click to toggle source
# File lib/mice.rb, line 42
def fonts_path
  File.join assets_path, 'fonts'
end
gem_path() click to toggle source

Paths

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

Inspired by Kaminari

# File lib/mice.rb, line 23
def load!
  register_compass_extension if compass?

  if rails?
    register_rails_engine
  end

  configure_sass
end
rails?() click to toggle source
# File lib/mice.rb, line 63
def rails?
  defined?(::Rails)
end
stylesheets_path() click to toggle source
# File lib/mice.rb, line 38
def stylesheets_path
  File.join assets_path, 'stylesheets'
end

Private Class Methods

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

  ::Sass.load_paths << stylesheets_path

  # https://github.com/twbs/bootstrap-sass/issues/409
  ::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max
end
register_compass_extension() click to toggle source
# File lib/mice.rb, line 78
def register_compass_extension
  ::Compass::Frameworks.register(
      'mice',
      :path                  => gem_path,
      :stylesheets_directory => stylesheets_path
  )
end
register_rails_engine() click to toggle source
# File lib/mice.rb, line 86
def register_rails_engine
  require 'mice/engine'
end