sawa
sawa

Reputation: 168081

What character can be used in a SCSS/SASS function and variable name?

What characters can be used in SCSS/SASS function names and variable names? I want to know especially which non-alphabets like _, -, numbers, punctuations, etc. can be used.

Upvotes: 1

Views: 470

Answers (1)

Joe
Joe

Reputation: 15802

http://sass-lang.com/documentation/file.SASS_CHANGELOG.html#variable_and_mixin_names

The current version of SASS is 3.4.5 (Sep 19, 2014). As of version 3.0.0, the following is true:

SassScript variable and mixin names may now contain hyphens. In fact, they may be any valid CSS3 identifier. For example:

$prettiest-color: #542FA9
=pretty-text
  color: $prettiest-color

There's no mention of any restrictions on function names in the official documentation, and from the source it appears to not do any kind of error-checking whatsoever. A "valid function name" appears to be completely undocumented.

Upvotes: 2

Related Questions