YouTip LogoYouTip

Sass Introspection Func

# Sass Introspection Functions [![Image 3: Sass Functions](#) Sass Functions](#) Sass Introspection functions are less commonly used for building stylesheets and are generally used for code debugging. The following table lists Sass's Introspection functions: | Function | Description & Example | | --- | --- | | call(_function_, _arguments_...) | Dynamic function invocation, i.e., calls the function `function` with arguments `arguments` and returns the result. | | content-exists() | Checks if the current mixin has been passed a `@content` block. | | feature-exists(_feature_) | Checks if the current Sass implementation supports the given feature. **Example:** `feature-exists("at-error");` Result: `true` | | function-exists(_functionname_) | Checks if the specified function exists. **Example:** `function-exists("nonsense")` Result: `false` | | get-function(_functionname_, css: false) | Returns the specified function. If `css` is `true`, returns a plain CSS function. | | global-variable-exists(_variablename_) | Checks if a global variable is defined. **Example:** `variable-exists(a)` Result: `true` | | inspect(_value_) | Returns a string representation of `value`, which is a Sass expression. | | mixin-exists(_mixinname_) | Checks if the specified mixin (`mixinname`) exists. **Example:** `mixin-exists("important-text")` Result: `true` | | type-of(_value_) | Returns the type of the value. The return value can be `number`, `string`, `color`, `list`, `map`, `bool`, `null`, `function`, or `arglist`. **Example:** `type-of(15px)` Result: `number`
`type-of(#ff0000)` Result: `color` | | unit(_number_) | Returns the unit (or compound unit) of the passed number. **Example:** `unit(15px)` Result: `px` | | unitless(_number_) | Returns a boolean indicating whether the passed number has a unit. **Example:** `unitless(15px)` Result: `false`
`unitless(15)` Result: `true` | | variable-exists(_variablename_) | Checks if a variable exists in the current scope. **Example:** `variable-exists(b)` Result: `true` | * * Sass Functions](#)
← Ng Ng ModelSass Map Func β†’