You are here

function _sassy_match_variables in Sassy 7

Extract SCSS variables from a SCSS string.

Parameters

$data: A SCSS string.

Return value

An array of variable values, indexed by the variable name.

1 call to _sassy_match_variables()
sassy_parse in ./sassy.module
Parse a SCSS string and transform it into CSS.

File

./sassy.module, line 214
Handles compiling of .sass / .scss files.

Code

function _sassy_match_variables($data, $syntax) {
  $variables = array();
  preg_match_all('/(^|\\n)\\$([^\\s]+): (.+);/', $data, $matches);
  foreach ($matches[2] as $key => $value) {
    $variables['$' . $value] = $matches[3][$key];
  }
  return $variables;
}