Sha256: d07c2b50695eab6414b206869ebcf4c56eb27e5f6cbfebf7cc52aafd059cfc28

Contents?: true

Size: 1.83 KB

Versions: 21

Compression:

Stored size: 1.83 KB

Contents

require "materialize-sass/version"

module Materialize
  module Sass
    # 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
        #::Sass::Script::Number.precision = [8, ::Sass::Script::Number.precision].max
      end

      #def register_compass_extension
      #  ::Compass::Frameworks.register(
      #      'materialize',
      #      :version               => Materialize::Sass::VERSION,
      #      :path                  => gem_path,
      #      :stylesheets_directory => stylesheets_path,
      #      :templates_directory   => File.join(gem_path, 'templates')
      #  )
      #end

      def register_rails_engine
        require 'materialize-sass/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::Sass.load!

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
materialize-sass-0.100.2.1 lib/materialize-sass.rb
materialize-sass-0.100.2 lib/materialize-sass.rb
materialize-sass-0.100.1 lib/materialize-sass.rb
materialize-sass-0.100.0 lib/materialize-sass.rb
materialize-sass-0.99.0 lib/materialize-sass.rb
materialize-sass-0.98.2 lib/materialize-sass.rb
materialize-sass-0.98.1 lib/materialize-sass.rb
materialize-sass-0.98.0 lib/materialize-sass.rb
materialize-sass-0.97.8 lib/materialize-sass.rb
materialize-sass-0.97.7 lib/materialize-sass.rb
materialize-sass-0.97.6 lib/materialize-sass.rb
materialize-sass-0.97.5 lib/materialize-sass.rb
materialize-sass-0.97.4 lib/materialize-sass.rb
materialize-sass-0.97.3 lib/materialize-sass.rb
materialize-sass-0.97.2 lib/materialize-sass.rb
materialize-sass-0.97.1 lib/materialize-sass.rb
materialize-sass-0.97.0 lib/materialize-sass.rb
materialize-sass-0.96.2 lib/materialize-sass.rb
materialize-sass-0.96.1 lib/materialize-sass.rb
materialize-sass-0.96.0 lib/materialize-sass.rb