/** * * 背景组合 * @param array $tokens */ public function updateBackgroundTokenType($tokens) { foreach ($tokens as &$token) { $value = $token['value']; $urlValue = Fl_Css_Static::isUrlValue($value); if (Fl_Css_Static::isColor($value)) { //背景色 $token['type'] = 'background-color'; } elseif ($urlValue) { //背景图 $token['type'] = 'background-image'; $token['clean_value'] = $urlValue; //解析的url值 } elseif (Fl_Css_Static::isBackgroundRepeat($value)) { //平铺方式 $token['type'] = 'background-repeat'; } elseif (Fl_Css_Static::isBackgroundAttachment($value)) { //背景固定方式 $token['type'] = 'background-attachment'; } elseif (Fl_Css_Static::isBackgroundPosition($value)) { //背景位置 $token['type'] = 'background-position'; } } return $tokens; }