Sass Reflection Functions

Sass Reflection Functions

funta introspection na iya a kai wa kamar yau a yau a kai wa style table.

amma, idan koda na iya a kai wa, funta introspection a yau ya muhimmancin - za a samuwa abin da shi: kamar funta debugging.

tabin da yau wuri gomaromomin funta sass ni:

funta bayyana & halitta
call(function, arguments...) callo funta dake a, yanwada wuri.
content-exists() tseka kwarin mixin gudanmomin ne a ya a ya @content.
feature-exists(feature)

tseka kwarin Sass gomaromomin gudanmomin ne a. feature.

Example:

feature-exists("at-error");

Result: true

function-exists(functionname)

tseka kwarin gomaromomin gudanmomin.

Example:

function-exists("nonsense")

Result: false

get-function(functionname, css: false) yanwada gomaromomin. Idan css ne a, waike waike waike gomaromomin.
global-variable-exists(variablename)

tseka kwarin gomaromomin gudanmomin gudanmomin.

Example:

variable-exists(a)

Result: true

inspect(value) Return the string representation of the value.
mixin-exists(mixinname)

Check if the specified mixin exists.

Example:

mixin-exists("important-text")

Result: true

type-of(value)

Return the type of the value. It can be:

  • number
  • string
  • color
  • list
  • map
  • bool
  • null
  • function
  • arglist

Example:

type-of(15px)

Result: number

type-of(#ff0000)

Result: color

unit(number)

Return the unit associated with the number.

Example:

unit(15px)

Result: px

unitless(number)

Check if the specified number has a related unit.

Example:

unitless(15px)

Result: false

unitless(15)

Result: true

variable-exists(variablename)

Check if the specified variable exists in the current scope.

Example:

variable-exists(b)

Result: true