Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Sass Introspection Functions

Sass Introspection Functions

Sass Functions Sass Functions

Sass Introspection functions are rarely used for building stylesheets and are generally used for code debugging.

The following table lists Sass's Introspection functions:

function Description & Examples
call(function, arguments...) Dynamic invocation of a function, that is, calling function with the arguments parameter and returning the result.
content-exists() Check whether the current mixin passes a @content block.
feature-exists(feature) Check whether the current Sass implementation supports this feature.
 **实例:**       

 feature-exists("at-error");       

 结果: true |

| function-exists(functionname) | Detect whether the specified function exists

 **实例:**       

 function-exists("nonsense")       

 结果: false |

| get-function(functionname, css: false) | Return the specified function. If css is true, return a pure CSS function. | | global-variable-exists(variablename) | Detect whether a certain global variable is defined.

 **实例:**       

 variable-exists(a)       

 结果: true |

| inspect(value) | Return a string representation; value is a sass expression. | | mixin-exists(mixinname) | Detect whether the specified mixin (mixinname) exists.

 **实例:**       

 mixin-exists("important-text")       

 结果: true |

| type-of(value) | Return the value type. The return value can be number, string, color, list, map, bool, null, function, or arglist.

 **实例:**       

 type-of(15px)       

 结果: number       

 type-of(#ff0000)       

 结果: color |

| unit(number) | Return the unit (or compound unit) of the passed number.

 **实例:**       

 unit(15px)       

 结果: px |

| unitless(number) | Return a boolean indicating whether the passed number has a unit.

 **实例:**       

 unitless(15px)       

 结果: false       

 unitless(15)       

 结果: true |

| variable-exists(variablename) | Determine whether a variable is in the current scope.

 **实例:**       

 variable-exists(b)       

 结果: true |


Sass Functions Sass Functions