Sha256: c0e4ac7bd50cd19cb3dc7a180eb966c9f221007c5df9e3e076eb76fb5f229a51

Contents?: true

Size: 1.7 KB

Versions: 14

Compression:

Stored size: 1.7 KB

Contents

module Fomantic
  module Ui
    module Sass
      class FrameworkNotFound < StandardError; end
      class << self
        def load!
          if defined?(::Rails)
            require 'fomantic/ui/sass/engine'
          elsif defined?(::Compass)
            ::Compass::Frameworks.register('fomantic-ui', path: base, stylesheets_directory: stylesheets_path, templates_directory: templates_path)
          elsif defined?(::Sprockets)
            Sprockets.append_path(stylesheets_path)
            Sprockets.append_path(fonts_path)
            Sprockets.append_path(images_path)
            Sprockets.append_path(javascripts_path)
          end

          configure_sass
          unless defined?(::Rails) || defined?(::Compass) || defined?(::Sprockets)
            raise Fomantic::Ui::Sass::FrameworkNotFound, 'fomantic-ui-sass requires either Rails > 3.1 or Compass, or Sprockets, none of which are loaded'
          end
        end

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

        def templates_path
          File.join(gem_path, 'templates')
        end

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

        def fonts_path
          File.join(assets_path, 'fonts')
        end

        def images_path
          File.join(assets_path, 'images')
        end

        def javascripts_path
          File.join(assets_path, 'javascripts')
        end

        def stylesheets_path
          File.join(assets_path, 'stylesheets')
        end

        def configure_sass
          require 'sassc'
          ::SassC.load_paths << stylesheets_path
        end
      end
    end
  end
end
Fomantic::Ui::Sass.load!

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fomantic-ui-sass-2.9.3 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.9.2 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.9.1 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.9.0 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.8.1 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.8 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.7.1 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.7 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.6 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.5 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.4 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.3 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.2 lib/fomantic-ui-sass.rb
fomantic-ui-sass-2.8.1.1 lib/fomantic-ui-sass.rb