csscomb.js icon indicating copy to clipboard operation
csscomb.js copied to clipboard

SASS functions shouldn't be ordered

Open vpoblete opened this issue 8 years ago • 0 comments

When I run CSScomb in my file "_tools.scss" that contains the function

@function encodecolor($string) {
	@if type-of($string) == 'color' {
		$hex: str-slice(ie-hex-str($string), 4);
		$string:unquote("#{$hex}");
	}
	$string: '%23' + $string;
	@return $string;
}

the result is

@function encodecolor($string) {
	$string: "%23" + $string;
	@if type-of($string) == "color" {
		$hex: str-slice(ie-hex-str($string), 4);
		$string: unquote("#{$hex}");
	}
	@return $string;
}

Reordering the line $string: "%23" + $string; produces an error in the function. I can't find any way to avoid this from happening.

vpoblete avatar Nov 09 '17 11:11 vpoblete