Sha256: df06ab7ca78abfe180e423e882d8f8dd5eaea2bec12b65ff271fd1c350f3c00d

Contents?: true

Size: 1.3 KB

Versions: 19

Compression:

Stored size: 1.3 KB

Contents

require 'set'
module Sass
  # Provides `Sass.has_feature?` which allows for simple feature detection
  # by providing a feature name.
  module Features
    # This is the set of features that can be detected.
    KNOWN_FEATURES = Set[*%w{
    }]

    # Check if a feature exists by name. This is used to implement
    # the Sass function `feature-exists($feature)`
    #
    # @param feature_name [String] The case sensitive name of the feature to
    #   check if it exists in this version of Sass.
    # @return [Boolean] whether the feature of that name exists.
    def has_feature?(feature_name)
      KNOWN_FEATURES.include?(feature_name)
    end

    # Add a feature to Sass. Plugins can use this to easily expose their
    # availability to end users. Plugins must prefix their feature
    # names with a dash to distinguish them from official features.
    #
    # @example
    #   Sass.add_feature("-import-globbing")
    #   Sass.add_feature("-math-cos")
    #
    #
    # @param feature_name [String] The case sensitive name of the feature to
    #   to add to Sass. Must begin with a dash.
    def add_feature(feature_name)
      unless feature_name[0] == ?-
        raise ArgumentError.new("Plugin feature names must begin with a dash")
      end
      KNOWN_FEATURES << feature_name
    end
  end

  extend Features
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sass-3.3.14 lib/sass/features.rb
sass-3.3.13 lib/sass/features.rb
sass-3.3.12 lib/sass/features.rb
sass-3.3.11 lib/sass/features.rb
sass-3.3.10 lib/sass/features.rb
sass-3.3.9 lib/sass/features.rb
sass-3.3.8 lib/sass/features.rb
sass-3.3.7 lib/sass/features.rb
sass-3.3.6 lib/sass/features.rb
sass-3.3.5 lib/sass/features.rb
sass-3.3.4 lib/sass/features.rb
sass-3.3.3 lib/sass/features.rb
sass-3.3.2 lib/sass/features.rb
sass-3.3.1 lib/sass/features.rb
sass-3.3.0 lib/sass/features.rb
sass-3.3.0.rc.6 lib/sass/features.rb
sass-3.3.0.rc.5 lib/sass/features.rb
sass-3.3.0.rc.4 lib/sass/features.rb
sass-3.3.0.rc.3 lib/sass/features.rb