Module: Sass::Features
- Included in:
- Sass
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/features.rb
Overview
Provides Sass.has_feature?
which allows for simple feature detection by providing a feature name.
Constant Summary
Instance Method Summary (collapse)
- - add_feature(feature_name)
Add a feature to Sass.
- - (Boolean) has_feature?(feature_name)
Check if a feature exists by name.
Instance Method Details
- add_feature(feature_name)
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.
38 39 40 41 42 43 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/features.rb', line 38
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 |
- (Boolean) has_feature?(feature_name)
Check if a feature exists by name. This is used to implement the Sass function feature-exists($feature)
23 24 25 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/features.rb', line 23
def has_feature?(feature_name)
KNOWN_FEATURES.include?(feature_name)
end |