Sha256: f9c44eed5ee14a7afe25bd30ee85bb034bba7f292b9ae2c082d3aa9fe778289e

Contents?: true

Size: 1.66 KB

Versions: 15

Compression:

Stored size: 1.66 KB

Contents

module FontAwesome
  module Sass
    class << self
      def load!
        if rails?
          register_rails_engine
        elsif sprockets?
          register_sprockets
        elsif compass?
          register_compass_extension
        elsif deprecated_sass?
          ::Sass.load_paths << stylesheets_path
        end
      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 assets_path
        @assets_path ||= File.join(gem_path, 'assets')
      end

      def sprockets?
        defined?(::Sprockets)
      end

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

      def rails?
        defined?(::Rails)
      end

      def deprecated_sass?
        # The deprecated `sass` gem:
        defined?(::Sass) && ::Sass.respond_to?(:load_paths)
      end

      private

      def register_compass_extension
        require 'font_awesome/sass/version'

        ::Compass::Frameworks.register(
          'font-awesome',
          version: FontAwesome::Sass::VERSION,
          path: gem_path,
          stylesheets_directory: stylesheets_path,
          templates_directory: File.join(gem_path, 'templates')
        )
      end

      def register_rails_engine
        require 'font_awesome/sass/rails/engine'
        require 'font_awesome/sass/rails/railtie'
      end

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

FontAwesome::Sass.load!

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/font-awesome-sass-5.15.1/lib/font-awesome-sass.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/font-awesome-sass-5.15.1/lib/font-awesome-sass.rb
font-awesome-sass-5.15.1 lib/font-awesome-sass.rb
font-awesome-sass-5.14.0 lib/font-awesome-sass.rb
font-awesome-sass-5.13.1 lib/font-awesome-sass.rb
font-awesome-sass-5.13.0 lib/font-awesome-sass.rb
font-awesome-sass-5.12.0 lib/font-awesome-sass.rb
font-awesome-sass-5.11.2 lib/font-awesome-sass.rb
font-awesome-sass-5.11.1 lib/font-awesome-sass.rb
font-awesome-sass-5.10.2 lib/font-awesome-sass.rb
font-awesome-sass-5.9.0 lib/font-awesome-sass.rb
font-awesome-sass-5.8.1 lib/font-awesome-sass.rb
font-awesome-sass-5.8.0 lib/font-awesome-sass.rb
font-awesome-sass-5.6.1 lib/font-awesome-sass.rb
font-awesome-sass-5.5.0.1 lib/font-awesome-sass.rb