module Hackathon::Starter::Ui
Public Class Methods
asset_pipeline?()
click to toggle source
Environment detection helpers
# File lib/hackathon-starter-ui-rails.rb, line 36 def asset_pipeline? defined?(::Sprockets) end
assets_path()
click to toggle source
# File lib/hackathon-starter-ui-rails.rb, line 31 def assets_path @assets_path ||= File.join gem_path, 'assets' end
compass?()
click to toggle source
# File lib/hackathon-starter-ui-rails.rb, line 40 def compass? defined?(::Compass) end
fonts_path()
click to toggle source
# File lib/hackathon-starter-ui-rails.rb, line 23 def fonts_path File.join assets_path, 'fonts' end
gem_path()
click to toggle source
Paths
# File lib/hackathon-starter-ui-rails.rb, line 15 def gem_path @gem_path ||= File.expand_path '..', File.dirname(__FILE__) end
javascripts_path()
click to toggle source
# File lib/hackathon-starter-ui-rails.rb, line 27 def javascripts_path File.join assets_path, 'javascripts' end
load!()
click to toggle source
Inspired by Kaminari
# File lib/hackathon-starter-ui-rails.rb, line 8 def load! register_compass_extension if compass? register_rails_engine if rails? configure_sass end
rails?()
click to toggle source
# File lib/hackathon-starter-ui-rails.rb, line 44 def rails? defined?(::Rails) end
stylesheets_path()
click to toggle source
# File lib/hackathon-starter-ui-rails.rb, line 19 def stylesheets_path File.join assets_path, 'stylesheets' end
Private Class Methods
configure_sass()
click to toggle source
# File lib/hackathon-starter-ui-rails.rb, line 50 def configure_sass require '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/hackathon-starter-ui-rails.rb, line 59 def register_compass_extension ::Compass::Frameworks.register( 'bootstrap', :version => "#{Hackathon::Starter::Ui::Rails::VERSION}.#{Hackathon::Starter::Ui::Rails::PATCHLEVEL}", :path => gem_path, :stylesheets_directory => stylesheets_path, :templates_directory => File.join(gem_path, 'templates') ) end
register_rails_engine()
click to toggle source
# File lib/hackathon-starter-ui-rails.rb, line 69 def register_rails_engine require 'hackathon/starter/ui/rails/engine' end