Sha256: 80a420cbae30d40fc7956cb09ae424f8de46ab01bbe490980c3513d17c09e789

Contents?: true

Size: 1.71 KB

Versions: 9

Compression:

Stored size: 1.71 KB

Contents

module Semantic
  module Ui
    module Sass
      class FrameworkNotFound < StandardError; end
      class << self
        def load!
          if defined?(::Rails)
            require 'semantic/ui/sass/engine'
          elsif defined?(::Compass)
            ::Compass::Frameworks.register('semantic-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
          if !(defined?(::Rails) || defined?(::Compass) || defined?(::Sprockets))
            raise Semantic::Ui::Sass::FrameworkNotFound, "semantic-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 'sass'
          ::Sass.load_paths << stylesheets_path
        end

      end
    end
  end
end
Semantic::Ui::Sass.load!

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
semantic-ui-sass-2.4.2.0 lib/semantic-ui-sass.rb
semantic-ui-sass-2.4.0.1 lib/semantic-ui-sass.rb
semantic-ui-sass-2.4.0.0 lib/semantic-ui-sass.rb
semantic-ui-sass-2.3.1.2 lib/semantic-ui-sass.rb
semantic-ui-sass-2.3.1.1 lib/semantic-ui-sass.rb
semantic-ui-sass-2.3.1.0 lib/semantic-ui-sass.rb
semantic-ui-sass-2.3.0.0 lib/semantic-ui-sass.rb
semantic-ui-sass-2.2.14 lib/semantic-ui-sass.rb
semantic-ui-sass-2.2.12.1 lib/semantic-ui-sass.rb