You are here

function sassy_compass__compact in Sassy 7.3

Same name and namespace in other branches
  1. 7.2 extensions/compass/functions/lists.inc \sassy_compass__compact()

File

sassy_compass/functions/lists.inc, line 18

Code

function sassy_compass__compact() {
  $sep = ', ';
  $args = func_get_args();
  $list = array();

  // remove blank entries
  // append non-blank entries to list
  foreach ($args as $k => $v) {
    if (is_object($v)) {
      $string = isset($v->value) ? $v->value : FALSE;
    }
    else {
      $string = (string) $v;
    }
    if (empty($string) || $string == 'false') {
      unset($args[$k]);
      continue;
    }
    $list[] = $string;
  }
  return new SassString(implode($sep, $list));
}