Sass Introspection function


Release date:2024-03-01 Update date:2024-03-01 Editor:admin View counts:145

Label:

Sass Introspection function

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

The following table lists the Sass’s Introspection function:

Function

Description & example

call(function, arguments...)

The dynamic call of the function, that is, the function parameter of the calling function is arguments and the result is returned.

content-exists()

Check to see if the current blend passes the @ content block.

feature-exists(feature)

Check whether the current Sass implementation supports this feature.

Example: feature-exists (“at-error”); result: true

function-exists(functionname)

Detect whether the specified function exists

Example: function-exists (“nonsense”) result: false

get-function(functionname, css: false)

Returns the specified function. If css is true, a pure CSS function is returned.

global-variable-exists(variablename)

Detects whether a global variable is defined.

Example: variable-exists (a) result: true

inspect(value)

Returns a representation of a string, where value is an sass expression.

mixin-exists(mixinname)

Detects the existence of the specified mixinname.

Example: mixin-exists (“important-text”) result: true

type-of(value)

Returns the value type. The returned values can be number, string, color, list, map, bool, null, function, arglist.

Example: type-of (15px) result: number type-of (# ff0000) result: color

unit(number)

Returns the unit (or compound unit) of the incoming number.

Example: unit (15px) result: px

unitless(number)

Returns a Boolean value to determine whether the incoming number has a unit.

Example: unitless (15px) result: false unitless (15) result: true

variable-exists(variablename)

Determine whether the variable is in the current scope.

Example: variable-exists (b) result: true

Powered by TorCMS (https://github.com/bukun/TorCMS).