module FlatUi

Constants

PRO_VERSION
VERSION

Public Class Methods

asset_pipeline?() click to toggle source

Environment detection helpers

# File lib/flat-ui-sass.rb, line 57
def asset_pipeline?
  defined?(::Sprockets)
end
assets_path() click to toggle source
# File lib/flat-ui-sass.rb, line 52
def assets_path
  @assets_path ||= File.join base_path, 'vendor', 'assets'
end
base_path() click to toggle source
# File lib/flat-ui-sass.rb, line 32
def base_path
  @base_path ||= pro? ? project_path : gem_path
end
compass?() click to toggle source
# File lib/flat-ui-sass.rb, line 61
def compass?
  defined?(::Compass)
end
fonts_path() click to toggle source
# File lib/flat-ui-sass.rb, line 40
def fonts_path
  File.join assets_path, 'fonts'
end
gem_path() click to toggle source

Paths

# File lib/flat-ui-sass.rb, line 23
def gem_path
  @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
end
images_path() click to toggle source
# File lib/flat-ui-sass.rb, line 48
def images_path
  File.join assets_path, 'images'
end
javascripts_path() click to toggle source
# File lib/flat-ui-sass.rb, line 44
def javascripts_path
  File.join assets_path, 'javascripts'
end
load!() click to toggle source
# File lib/flat-ui-sass.rb, line 9
def load!
  require 'flat-ui-sass/sass_functions'

  register_compass_extension if compass?

  if rails?
    require 'sass-rails'
    register_rails_engine
  end

  configure_sass
end
pro?() click to toggle source
# File lib/flat-ui-sass.rb, line 69
def pro?
  Dir.exists? File.join(project_path, 'vendor/assets/stylesheets/flat-ui-pro')
end
project_path() click to toggle source

This definitely needs a better solution

# File lib/flat-ui-sass.rb, line 28
def project_path
  @project_path ||= Dir.pwd
end
rails?() click to toggle source
# File lib/flat-ui-sass.rb, line 65
def rails?
  defined?(::Rails)
end
stylesheets_path() click to toggle source
# File lib/flat-ui-sass.rb, line 36
def stylesheets_path
  File.join assets_path, 'stylesheets'
end

Private Class Methods

configure_sass() click to toggle source
# File lib/flat-ui-sass.rb, line 75
def configure_sass
  ::Sass.load_paths << stylesheets_path

  # bootstrap requires minimum precision of 10, see 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/flat-ui-sass.rb, line 82
def register_compass_extension
  ::Compass::Frameworks.register(
      pro? ? 'flat-ui-pro' :  'flat-ui',
      :path                  => gem_path,
      :stylesheets_directory => stylesheets_path,
      :templates_directory   => File.join(gem_path, 'templates')
  )
end
register_rails_engine() click to toggle source
# File lib/flat-ui-sass.rb, line 91
def register_rails_engine
  require 'flat-ui-sass/engine'
end