Skip to content
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

Not evaluating number when passing variables #98

Open
amykapernick opened this issue Apr 26, 2023 · 0 comments
Open

Not evaluating number when passing variables #98

amykapernick opened this issue Apr 26, 2023 · 0 comments

Comments

@amykapernick
Copy link

I have a mixin function that I use to place labels on a range slider, something like this

@mixin range_labels {
	$span: 3;

	@for $i from 1 through 5 {
		$odd: ($i * 2) - 1;
		$start_odd: (($i - 1) * $span);

		&:nth-child(#{$odd}) {
			grid-column: $start_odd  / span $span;
		}
	}
}

But when it compiles out, it's not evaluating the results of the variables, eg. $odd: ($i *2) - 1 which gives invalid CSS when a function is passed into an nth-child selector

.label:nth-child((1 * 2) - 1){
    grid-column:((1 - 1) * 3) / span 3
}
.label:nth-child((2 * 2) - 1){
    grid-column:((2 - 1) * 3) / span 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant