-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compact function #67
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,13 +78,24 @@ | |
} | ||
|
||
@if not(function-exists(compact)) { | ||
@function compact($vars...) { | ||
@function compact($args...) { | ||
$first: nth($args, 1); | ||
$sep: comma; | ||
$list: (); | ||
@each $var in $vars { | ||
@if $var { | ||
$list: append($list, $var, comma); | ||
} | ||
|
||
@if length($args) == 1 and type_of($first) == 'list' { | ||
$args: $first; | ||
$sep: list-separator($args); | ||
} | ||
|
||
@for $index from 1 through length($args) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The $arg will be Tested with single transition and multiple transitions, all work fine.
|
||
$arg: nth($args, $index); | ||
|
||
@if $arg { | ||
$list: append($list, $arg, $sep); | ||
} | ||
} | ||
|
||
@return $list; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Ruby version:
https://github.com/Compass/compass/blob/master/core/lib/compass/core/sass_extensions/functions/lists.rb#L18