module Luda

Constants

SASS_PRECISION
VERSION

Public Class Methods

assets_path() click to toggle source
# File lib/luda.rb, line 44
def assets_path
  @assets_path ||= File.join gem_path, 'assets'
end
gem_path() click to toggle source

Paths

# File lib/luda.rb, line 32
def gem_path
  @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
end
hanami?() click to toggle source
# File lib/luda.rb, line 57
def hanami?
  defined?(::Hanami)
end
javascripts_path() click to toggle source
# File lib/luda.rb, line 40
def javascripts_path
  File.join assets_path, 'javascripts'
end
load!() click to toggle source
# File lib/luda.rb, line 8
def load!
  if rails?
    register_rails_engine
  elsif hanami?
    register_hanami
  elsif sprockets?
    register_sprockets
  elsif defined?(::SassC) && ::SassC.respond_to?(:load_paths)
    ::SassC.load_paths << stylesheets_path
  elsif defined?(::Sass) && ::Sass.respond_to?(:load_paths)
    # The deprecated `sass` gem:
    ::Sass.load_paths << stylesheets_path
  end

  if defined?(::SassC::Script::Value::Number)
    ::SassC::Script::Value::Number.precision = [Luda::SASS_PRECISION, ::SassC::Script::Value::Number.precision].max
  end

  if defined?(::Sass::Script::Value::Number)
    ::Sass::Script::Value::Number.precision = [Luda::SASS_PRECISION, ::Sass::Script::Value::Number.precision].max
  end
end
rails?() click to toggle source
# File lib/luda.rb, line 53
def rails?
  defined?(::Rails)
end
sprockets?() click to toggle source

Environment detection helpers

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

Private Class Methods

register_hanami() click to toggle source
# File lib/luda.rb, line 72
def register_hanami
  Hanami::Assets.sources << assets_path
end
register_rails_engine() click to toggle source
# File lib/luda.rb, line 63
def register_rails_engine
  require 'luda/engine'
end
register_sprockets() click to toggle source
# File lib/luda.rb, line 67
def register_sprockets
  Sprockets.append_path(stylesheets_path)
  Sprockets.append_path(javascripts_path)
end