Sha256: a6c6be4deeb5661fd584df57a37f407f660e74d3dc03fda6a8e0bc3bfa39961d

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

require "colorgy_style/version"

module ColorgyStyle
  # Give credit to bootstrap-sass
  class << self
    # Inspired by Kaminari
    def load!
      if rails?
        register_rails_engine
      elsif sprockets?
        register_sprockets
      end

      configure_sass
    end

    # Paths

    def gem_path
      @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
    end

    def assets_path
      @assets_path ||= File.join gem_path, 'assets'
    end

    def stylesheets_path
      File.join assets_path, 'stylesheets'
    end

    def fonts_path
      File.join assets_path, 'fonts'
    end

    def javascripts_path
      File.join assets_path, 'javascripts'
    end

    # Environment detection helpers

    def sprockets?
      defined?(::Sprockets)
    end

    def rails?
      defined?(::Rails)
    end

    private

    def configure_sass
      require 'sass'

      ::Sass.load_paths << stylesheets_path
    end

    def register_rails_engine
      require 'colorgy_style/rails'
    end

    def register_sprockets
      Sprockets.append_path(stylesheets_path)
      Sprockets.append_path(fonts_path)
      Sprockets.append_path(javascripts_path)
    end
  end
end

ColorgyStyle.load!

require 'bootstrap-sass'
require 'materialize-sass'
require 'sass-globbing' unless defined?(Rails::VERSION::STRING) &&
                               Rails::VERSION::STRING.to_f >= 3.1

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
colorgy_style-0.0.0.4 lib/colorgy_style.rb
colorgy_style-0.0.0.2 lib/colorgy_style.rb
colorgy_style-0.0.0.1 lib/colorgy_style.rb