Sha256: 2c262b851c2c8e7a159016dbafce985e9dec4b2dcb190b150cbb25623755fa47

Contents?: true

Size: 1.39 KB

Versions: 8

Compression:

Stored size: 1.39 KB

Contents

require "materialize/form/version"

module Materialize
  module Form
    # give credit to bootstrap-sass
    class << self

      def load!
        #register_compass_extension if compass?
        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 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

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

      # Environment detection helpers
      def sprockets?
        defined?(::Sprockets)
      end

      #def compass?
      #  defined?(::Compass)
      #end

      def rails?
        defined?(::Rails)
      end

      private

      def configure_sass
        require 'sass'
        ::Sass.load_paths << stylesheets_path
      end

      def register_rails_engine
        require 'materialize/form/engine'
      end

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

    end
  end
end

Materialize::Form.load!

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
materialize-form-1.0.8 lib/materialize/form.rb
materialize-form-1.0.7 lib/materialize/form.rb
materialize-form-1.0.6 lib/materialize/form.rb
materialize-form-1.0.5 lib/materialize/form.rb
materialize-form-1.0.4 lib/materialize/form.rb
materialize-form-1.0.3 lib/materialize/form.rb
materialize-form-1.0.2 lib/materialize/form.rb
materialize-form-1.0.1 lib/materialize/form.rb