Data types

Data Types SassScript supports seven main data types: numbers (e.g. 1.2, 13, 10px) strings of text, with and without quotes (e.g. "foo", 'bar', baz) colors (e.g. blue, #04a3f9, rgba(255, 0, 0, 0.5)) booleans (e.g. true, false) nulls (e.g. null) lists of values, separated by spaces or commas (e.g. 1.5em 1em 0 2em, Helvetica, Arial, sans-serif) maps from one value to another (e.g. (key1: value1, key2: value2)) SassScript also supports all other types of CSS property value, such as Unicode range

unitless

unitless($number) Returns whether a number has units. Examples: unitless(100) => true unitless(100px) => false Parameters: $number (Number) Returns: (Bool) Raises: (ArgumentError) — if $number isn’t a number

grayscale

grayscale($color) Converts a color to grayscale. This is identical to desaturate(color, 100%). Parameters: $color (Color) Returns: (Color) Raises: (ArgumentError) — if $color isn’t a color

inspect

inspect($value) Return a string containing the value as its Sass representation. Parameters: $value (Base) — The value to inspect. Returns: (String) — A representation of the value as it would be written in Sass.

str_length

str_length($string) Returns the number of characters in a string. Examples: str-length("foo") => 3 Parameters: $string (String) Returns: (Number) Raises: (ArgumentError) — if $string isn’t a string

opacity

opacity($color) Returns the alpha component (opacity) of a color. This is 1 unless otherwise specified. Parameters: $color (Color) Returns: (Number) — The alpha component, between 0 and 1 Raises: (ArgumentError) — if $color isn’t a color

call

call($name, $args...) Dynamically calls a function. This can call user-defined functions, built-in functions, or plain CSS functions. It will pass along all arguments, including keyword arguments, to the called function. Examples: call(rgb, 10, 100, 255) => #0a64ff call(scale-color, #0a64ff, $lightness: -10%) => #0058ef $fn: nth; call($fn, (a b c), 2) => b Parameters: $name (String) — The name of the function to call.

append

append($list, $val, $separator:auto) Appends a single value onto the end of a list. Unless the $separator argument is passed, if the list had only one item, the resulting list will be space-separated. Like all list functions, append() returns a new list rather than modifying its argument in place. Examples: append(10px 20px, 30px) => 10px 20px 30px append((blue, red), green) => blue, red, green append(10px 20px, 30px 40px) => 10px 20px (30px 40px) append(10px, 20px, comma) => 10

quote

quote($string) Add quotes to a string if the string isn’t quoted, or returns the same string if it is. Examples: quote("foo") => "foo" quote(foo) => "foo" Parameters: $string (String) Returns: (String) Raises: (ArgumentError) — if $string isn’t a string

selector_replace

selector_replace($selector, $original, $replacement) Replaces all instances of $original with $replacement in $selector This works by using @extend and throwing away the original selector. This means that it can be used to do very advanced replacements; see the examples below. Examples: selector-replace(".foo .bar", ".bar", ".baz") => ".foo .baz" selector-replace(".foo.bar.baz", ".foo.baz", ".qux") => ".bar.qux" Returns A list of lists of strings representing the result of the exte