- Included in:
- Defined in:
Provides `Sass.has_feature?` which allows for simple feature detection by providing a feature name.
- KNOWN_FEATURES =
This is the set of features that can be detected.
When this is updated, the documentation of `feature-exists()` should be updated as well.
Set[*%w( global-variable-shadowing extend-selector-pseudoclass units-level-3 at-error custom-property )]
Instance Method Summary (collapse)
- #add_feature(feature_name) ⇒ Object
Add a feature to Sass.
- #has_feature?(feature_name) ⇒ Boolean
Check if a feature exists by name.
Instance Method Details
#add_feature(feature_name) ⇒ Object
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.
39 40 41 42 43 44
# File '.sass/lib/sass/features.rb', line 39 def add_feature(feature_name) unless feature_name == ?- raise ArgumentError.new("Plugin feature names must begin with a dash") end << feature_name end
#has_feature?(feature_name) ⇒ Boolean
Check if a feature exists by name. This is used to implement the Sass function `feature-exists($feature)`
24 25 26
# File '.sass/lib/sass/features.rb', line 24 def has_feature?(feature_name) .include?(feature_name) end