Get (value + 1) in @each loop with multiple values











up vote
3
down vote

favorite












To accomplish my CSS, I use the SCSS framework inuitcss (https://github.com/inuitcss/inuitcss), which provides utilities for responsive spacings that look like this:



.u-1/3@mobile
.u-margin-bottom@mobile


A class like this follows the "mobile first" approach, which means, if there is change in a tablet or desktop state, it needs to be "overwritten" or "cancelled" by the use of another utility class, which looks like this:



.u-1/2@tablet
.u-margin-bottom-none@tablet


I would like to change this behaviour by tying some of those utility classes to their responsive state only, so that a cancellation is not necessary.



Currently, the mixin responsible for the generation of those utility classes looks like this (it uses Sass-mq):



@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {  
@include mq($from: $inuit-bp-name) {
@include inuit-widths($inuit-fractions, #{$inuit-widths-breakpoint-separator}#{$inuit-bp-name});
}
}


In order to achieve my goal, I would have to adapt the @include mq( function to use a second parameter, which would look like this:



@include mq($from: $inuit-bp-name, $to: [next $inuit-bp-name]) {


And here are my problems:




  1. How do I get the next value in the map?


  2. How would I possibly prevent an error if there is no next value?



I at least managed to get the index value, like this:



@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {  
$i: index(($mq-breakpoints), ($inuit-bp-name $inuit-bp-value));
@debug "INDEX" $i;
}


For easier testing I prepared a codepen with this code, which can be found here:
https://codepen.io/rowild/pen/EOgvKy










share|improve this question
























  • I think this guy wrote the solution for you: github.com/elcheio/sass-map-get-next-prev :-)
    – ReSedano
    Nov 12 at 17:09










  • That looks great, and I think it is what I need - prefect and thank you so much! - Could you post your solution as an answer, then I can up-vote it!
    – Robert Wildling
    Nov 12 at 21:25










  • You 're welcome! :-) Thanks for the proposal, @Robert Wildling, really appreciated! But this time I did nothing. I just found a great job of a web developer. He deserves the up-vote, not me ;-)
    – ReSedano
    Nov 12 at 21:33










  • I appreciate your modesty!!! But it is not only to give you some points, but also to indicate that the question has been answered positively, which might help others... So is there any chance I can persuade you anyway to post you solution as answer? :-D
    – Robert Wildling
    Nov 12 at 22:07










  • You are right! We can do this: Why don't you finish your job making it work with the developer's map-get-next function and then post it as an answer? I'll be the first to up-vote! ;)
    – ReSedano
    Nov 12 at 22:19















up vote
3
down vote

favorite












To accomplish my CSS, I use the SCSS framework inuitcss (https://github.com/inuitcss/inuitcss), which provides utilities for responsive spacings that look like this:



.u-1/3@mobile
.u-margin-bottom@mobile


A class like this follows the "mobile first" approach, which means, if there is change in a tablet or desktop state, it needs to be "overwritten" or "cancelled" by the use of another utility class, which looks like this:



.u-1/2@tablet
.u-margin-bottom-none@tablet


I would like to change this behaviour by tying some of those utility classes to their responsive state only, so that a cancellation is not necessary.



Currently, the mixin responsible for the generation of those utility classes looks like this (it uses Sass-mq):



@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {  
@include mq($from: $inuit-bp-name) {
@include inuit-widths($inuit-fractions, #{$inuit-widths-breakpoint-separator}#{$inuit-bp-name});
}
}


In order to achieve my goal, I would have to adapt the @include mq( function to use a second parameter, which would look like this:



@include mq($from: $inuit-bp-name, $to: [next $inuit-bp-name]) {


And here are my problems:




  1. How do I get the next value in the map?


  2. How would I possibly prevent an error if there is no next value?



I at least managed to get the index value, like this:



@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {  
$i: index(($mq-breakpoints), ($inuit-bp-name $inuit-bp-value));
@debug "INDEX" $i;
}


For easier testing I prepared a codepen with this code, which can be found here:
https://codepen.io/rowild/pen/EOgvKy










share|improve this question
























  • I think this guy wrote the solution for you: github.com/elcheio/sass-map-get-next-prev :-)
    – ReSedano
    Nov 12 at 17:09










  • That looks great, and I think it is what I need - prefect and thank you so much! - Could you post your solution as an answer, then I can up-vote it!
    – Robert Wildling
    Nov 12 at 21:25










  • You 're welcome! :-) Thanks for the proposal, @Robert Wildling, really appreciated! But this time I did nothing. I just found a great job of a web developer. He deserves the up-vote, not me ;-)
    – ReSedano
    Nov 12 at 21:33










  • I appreciate your modesty!!! But it is not only to give you some points, but also to indicate that the question has been answered positively, which might help others... So is there any chance I can persuade you anyway to post you solution as answer? :-D
    – Robert Wildling
    Nov 12 at 22:07










  • You are right! We can do this: Why don't you finish your job making it work with the developer's map-get-next function and then post it as an answer? I'll be the first to up-vote! ;)
    – ReSedano
    Nov 12 at 22:19













up vote
3
down vote

favorite









up vote
3
down vote

favorite











To accomplish my CSS, I use the SCSS framework inuitcss (https://github.com/inuitcss/inuitcss), which provides utilities for responsive spacings that look like this:



.u-1/3@mobile
.u-margin-bottom@mobile


A class like this follows the "mobile first" approach, which means, if there is change in a tablet or desktop state, it needs to be "overwritten" or "cancelled" by the use of another utility class, which looks like this:



.u-1/2@tablet
.u-margin-bottom-none@tablet


I would like to change this behaviour by tying some of those utility classes to their responsive state only, so that a cancellation is not necessary.



Currently, the mixin responsible for the generation of those utility classes looks like this (it uses Sass-mq):



@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {  
@include mq($from: $inuit-bp-name) {
@include inuit-widths($inuit-fractions, #{$inuit-widths-breakpoint-separator}#{$inuit-bp-name});
}
}


In order to achieve my goal, I would have to adapt the @include mq( function to use a second parameter, which would look like this:



@include mq($from: $inuit-bp-name, $to: [next $inuit-bp-name]) {


And here are my problems:




  1. How do I get the next value in the map?


  2. How would I possibly prevent an error if there is no next value?



I at least managed to get the index value, like this:



@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {  
$i: index(($mq-breakpoints), ($inuit-bp-name $inuit-bp-value));
@debug "INDEX" $i;
}


For easier testing I prepared a codepen with this code, which can be found here:
https://codepen.io/rowild/pen/EOgvKy










share|improve this question















To accomplish my CSS, I use the SCSS framework inuitcss (https://github.com/inuitcss/inuitcss), which provides utilities for responsive spacings that look like this:



.u-1/3@mobile
.u-margin-bottom@mobile


A class like this follows the "mobile first" approach, which means, if there is change in a tablet or desktop state, it needs to be "overwritten" or "cancelled" by the use of another utility class, which looks like this:



.u-1/2@tablet
.u-margin-bottom-none@tablet


I would like to change this behaviour by tying some of those utility classes to their responsive state only, so that a cancellation is not necessary.



Currently, the mixin responsible for the generation of those utility classes looks like this (it uses Sass-mq):



@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {  
@include mq($from: $inuit-bp-name) {
@include inuit-widths($inuit-fractions, #{$inuit-widths-breakpoint-separator}#{$inuit-bp-name});
}
}


In order to achieve my goal, I would have to adapt the @include mq( function to use a second parameter, which would look like this:



@include mq($from: $inuit-bp-name, $to: [next $inuit-bp-name]) {


And here are my problems:




  1. How do I get the next value in the map?


  2. How would I possibly prevent an error if there is no next value?



I at least managed to get the index value, like this:



@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {  
$i: index(($mq-breakpoints), ($inuit-bp-name $inuit-bp-value));
@debug "INDEX" $i;
}


For easier testing I prepared a codepen with this code, which can be found here:
https://codepen.io/rowild/pen/EOgvKy







sass each






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 13:16

























asked Nov 11 at 12:21









Robert Wildling

214211




214211












  • I think this guy wrote the solution for you: github.com/elcheio/sass-map-get-next-prev :-)
    – ReSedano
    Nov 12 at 17:09










  • That looks great, and I think it is what I need - prefect and thank you so much! - Could you post your solution as an answer, then I can up-vote it!
    – Robert Wildling
    Nov 12 at 21:25










  • You 're welcome! :-) Thanks for the proposal, @Robert Wildling, really appreciated! But this time I did nothing. I just found a great job of a web developer. He deserves the up-vote, not me ;-)
    – ReSedano
    Nov 12 at 21:33










  • I appreciate your modesty!!! But it is not only to give you some points, but also to indicate that the question has been answered positively, which might help others... So is there any chance I can persuade you anyway to post you solution as answer? :-D
    – Robert Wildling
    Nov 12 at 22:07










  • You are right! We can do this: Why don't you finish your job making it work with the developer's map-get-next function and then post it as an answer? I'll be the first to up-vote! ;)
    – ReSedano
    Nov 12 at 22:19


















  • I think this guy wrote the solution for you: github.com/elcheio/sass-map-get-next-prev :-)
    – ReSedano
    Nov 12 at 17:09










  • That looks great, and I think it is what I need - prefect and thank you so much! - Could you post your solution as an answer, then I can up-vote it!
    – Robert Wildling
    Nov 12 at 21:25










  • You 're welcome! :-) Thanks for the proposal, @Robert Wildling, really appreciated! But this time I did nothing. I just found a great job of a web developer. He deserves the up-vote, not me ;-)
    – ReSedano
    Nov 12 at 21:33










  • I appreciate your modesty!!! But it is not only to give you some points, but also to indicate that the question has been answered positively, which might help others... So is there any chance I can persuade you anyway to post you solution as answer? :-D
    – Robert Wildling
    Nov 12 at 22:07










  • You are right! We can do this: Why don't you finish your job making it work with the developer's map-get-next function and then post it as an answer? I'll be the first to up-vote! ;)
    – ReSedano
    Nov 12 at 22:19
















I think this guy wrote the solution for you: github.com/elcheio/sass-map-get-next-prev :-)
– ReSedano
Nov 12 at 17:09




I think this guy wrote the solution for you: github.com/elcheio/sass-map-get-next-prev :-)
– ReSedano
Nov 12 at 17:09












That looks great, and I think it is what I need - prefect and thank you so much! - Could you post your solution as an answer, then I can up-vote it!
– Robert Wildling
Nov 12 at 21:25




That looks great, and I think it is what I need - prefect and thank you so much! - Could you post your solution as an answer, then I can up-vote it!
– Robert Wildling
Nov 12 at 21:25












You 're welcome! :-) Thanks for the proposal, @Robert Wildling, really appreciated! But this time I did nothing. I just found a great job of a web developer. He deserves the up-vote, not me ;-)
– ReSedano
Nov 12 at 21:33




You 're welcome! :-) Thanks for the proposal, @Robert Wildling, really appreciated! But this time I did nothing. I just found a great job of a web developer. He deserves the up-vote, not me ;-)
– ReSedano
Nov 12 at 21:33












I appreciate your modesty!!! But it is not only to give you some points, but also to indicate that the question has been answered positively, which might help others... So is there any chance I can persuade you anyway to post you solution as answer? :-D
– Robert Wildling
Nov 12 at 22:07




I appreciate your modesty!!! But it is not only to give you some points, but also to indicate that the question has been answered positively, which might help others... So is there any chance I can persuade you anyway to post you solution as answer? :-D
– Robert Wildling
Nov 12 at 22:07












You are right! We can do this: Why don't you finish your job making it work with the developer's map-get-next function and then post it as an answer? I'll be the first to up-vote! ;)
– ReSedano
Nov 12 at 22:19




You are right! We can do this: Why don't you finish your job making it work with the developer's map-get-next function and then post it as an answer? I'll be the first to up-vote! ;)
– ReSedano
Nov 12 at 22:19












1 Answer
1






active

oldest

votes

















up vote
1
down vote













Since it is currently not possible to link to Inuitcss from within codepen (neither is there a CDN), I first had to prepare a github repsoitory that takes care of that using github pages. Please find it here, if you want to quickly implement inuitcss in codepen, jsFiddle etc, too (including the "restricted responsive spacings" classes and others):



https://github.com/rowild/inuitcss-generated



A example codepen that shows how to include inuitcss into codepen can be found here:



https://codepen.io/rowild/pen/YRVvRe



As for the SCSS function that generates "restricted responsive spacings" classes (as i call them now), I did the following:



In the innerest loop, a new variable $next holds the map's next value.




  • If that value is not null, create the media query and the class with
    a "-only" suffix.

  • If the value is false, do nothing (because the
    regular inuitcss spacing classes cover that scenario already; I
    left the commented code here nevertheless, maybe it serves a
    purpose...):


The new function looks like this:



//scss
@if ($inuit-restricted-responsive-spacing-properties != null) {
@each $property-namespace, $property in $inuit-restricted-responsive-spacing-properties {
@each $direction-namespace, $direction-rules in $inuit-restricted-responsive-spacing-directions {
@each $size-namespace, $size in $inuit-restricted-responsive-spacing-sizes {
@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {

// Check, if the next breakpoint exists; if not, do not generate any classes.
// Add a '-only' suffix (could probably be made configurable via a variable...)
$next: map-get-next($mq-breakpoints, $inuit-bp-name, null);

@if ($next) {
@include mq($from: $inuit-bp-name, $until: map-get-next($mq-breakpoints, $inuit-bp-name, null)) {
.u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name}-only {
@each $direction in $direction-rules {
#{$property}#{$direction}: $size !important;
}
}
}
}

// Not necessary, because this os covered by the regular inuitcss classes already
// @else {
// @include mq($from: $inuit-bp-name) {
// .u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name} {
// @each $direction in $direction-rules {
// #{$property}#{$direction}: $size !important;
// }
// }
// }
// }
}
}
}
}


Thank you, ReSedano!






share|improve this answer





















  • Well done, Robert! You did a great job! :-)
    – ReSedano
    Nov 15 at 21:51













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248707%2fget-value-1-in-each-loop-with-multiple-values%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













Since it is currently not possible to link to Inuitcss from within codepen (neither is there a CDN), I first had to prepare a github repsoitory that takes care of that using github pages. Please find it here, if you want to quickly implement inuitcss in codepen, jsFiddle etc, too (including the "restricted responsive spacings" classes and others):



https://github.com/rowild/inuitcss-generated



A example codepen that shows how to include inuitcss into codepen can be found here:



https://codepen.io/rowild/pen/YRVvRe



As for the SCSS function that generates "restricted responsive spacings" classes (as i call them now), I did the following:



In the innerest loop, a new variable $next holds the map's next value.




  • If that value is not null, create the media query and the class with
    a "-only" suffix.

  • If the value is false, do nothing (because the
    regular inuitcss spacing classes cover that scenario already; I
    left the commented code here nevertheless, maybe it serves a
    purpose...):


The new function looks like this:



//scss
@if ($inuit-restricted-responsive-spacing-properties != null) {
@each $property-namespace, $property in $inuit-restricted-responsive-spacing-properties {
@each $direction-namespace, $direction-rules in $inuit-restricted-responsive-spacing-directions {
@each $size-namespace, $size in $inuit-restricted-responsive-spacing-sizes {
@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {

// Check, if the next breakpoint exists; if not, do not generate any classes.
// Add a '-only' suffix (could probably be made configurable via a variable...)
$next: map-get-next($mq-breakpoints, $inuit-bp-name, null);

@if ($next) {
@include mq($from: $inuit-bp-name, $until: map-get-next($mq-breakpoints, $inuit-bp-name, null)) {
.u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name}-only {
@each $direction in $direction-rules {
#{$property}#{$direction}: $size !important;
}
}
}
}

// Not necessary, because this os covered by the regular inuitcss classes already
// @else {
// @include mq($from: $inuit-bp-name) {
// .u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name} {
// @each $direction in $direction-rules {
// #{$property}#{$direction}: $size !important;
// }
// }
// }
// }
}
}
}
}


Thank you, ReSedano!






share|improve this answer





















  • Well done, Robert! You did a great job! :-)
    – ReSedano
    Nov 15 at 21:51

















up vote
1
down vote













Since it is currently not possible to link to Inuitcss from within codepen (neither is there a CDN), I first had to prepare a github repsoitory that takes care of that using github pages. Please find it here, if you want to quickly implement inuitcss in codepen, jsFiddle etc, too (including the "restricted responsive spacings" classes and others):



https://github.com/rowild/inuitcss-generated



A example codepen that shows how to include inuitcss into codepen can be found here:



https://codepen.io/rowild/pen/YRVvRe



As for the SCSS function that generates "restricted responsive spacings" classes (as i call them now), I did the following:



In the innerest loop, a new variable $next holds the map's next value.




  • If that value is not null, create the media query and the class with
    a "-only" suffix.

  • If the value is false, do nothing (because the
    regular inuitcss spacing classes cover that scenario already; I
    left the commented code here nevertheless, maybe it serves a
    purpose...):


The new function looks like this:



//scss
@if ($inuit-restricted-responsive-spacing-properties != null) {
@each $property-namespace, $property in $inuit-restricted-responsive-spacing-properties {
@each $direction-namespace, $direction-rules in $inuit-restricted-responsive-spacing-directions {
@each $size-namespace, $size in $inuit-restricted-responsive-spacing-sizes {
@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {

// Check, if the next breakpoint exists; if not, do not generate any classes.
// Add a '-only' suffix (could probably be made configurable via a variable...)
$next: map-get-next($mq-breakpoints, $inuit-bp-name, null);

@if ($next) {
@include mq($from: $inuit-bp-name, $until: map-get-next($mq-breakpoints, $inuit-bp-name, null)) {
.u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name}-only {
@each $direction in $direction-rules {
#{$property}#{$direction}: $size !important;
}
}
}
}

// Not necessary, because this os covered by the regular inuitcss classes already
// @else {
// @include mq($from: $inuit-bp-name) {
// .u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name} {
// @each $direction in $direction-rules {
// #{$property}#{$direction}: $size !important;
// }
// }
// }
// }
}
}
}
}


Thank you, ReSedano!






share|improve this answer





















  • Well done, Robert! You did a great job! :-)
    – ReSedano
    Nov 15 at 21:51















up vote
1
down vote










up vote
1
down vote









Since it is currently not possible to link to Inuitcss from within codepen (neither is there a CDN), I first had to prepare a github repsoitory that takes care of that using github pages. Please find it here, if you want to quickly implement inuitcss in codepen, jsFiddle etc, too (including the "restricted responsive spacings" classes and others):



https://github.com/rowild/inuitcss-generated



A example codepen that shows how to include inuitcss into codepen can be found here:



https://codepen.io/rowild/pen/YRVvRe



As for the SCSS function that generates "restricted responsive spacings" classes (as i call them now), I did the following:



In the innerest loop, a new variable $next holds the map's next value.




  • If that value is not null, create the media query and the class with
    a "-only" suffix.

  • If the value is false, do nothing (because the
    regular inuitcss spacing classes cover that scenario already; I
    left the commented code here nevertheless, maybe it serves a
    purpose...):


The new function looks like this:



//scss
@if ($inuit-restricted-responsive-spacing-properties != null) {
@each $property-namespace, $property in $inuit-restricted-responsive-spacing-properties {
@each $direction-namespace, $direction-rules in $inuit-restricted-responsive-spacing-directions {
@each $size-namespace, $size in $inuit-restricted-responsive-spacing-sizes {
@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {

// Check, if the next breakpoint exists; if not, do not generate any classes.
// Add a '-only' suffix (could probably be made configurable via a variable...)
$next: map-get-next($mq-breakpoints, $inuit-bp-name, null);

@if ($next) {
@include mq($from: $inuit-bp-name, $until: map-get-next($mq-breakpoints, $inuit-bp-name, null)) {
.u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name}-only {
@each $direction in $direction-rules {
#{$property}#{$direction}: $size !important;
}
}
}
}

// Not necessary, because this os covered by the regular inuitcss classes already
// @else {
// @include mq($from: $inuit-bp-name) {
// .u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name} {
// @each $direction in $direction-rules {
// #{$property}#{$direction}: $size !important;
// }
// }
// }
// }
}
}
}
}


Thank you, ReSedano!






share|improve this answer












Since it is currently not possible to link to Inuitcss from within codepen (neither is there a CDN), I first had to prepare a github repsoitory that takes care of that using github pages. Please find it here, if you want to quickly implement inuitcss in codepen, jsFiddle etc, too (including the "restricted responsive spacings" classes and others):



https://github.com/rowild/inuitcss-generated



A example codepen that shows how to include inuitcss into codepen can be found here:



https://codepen.io/rowild/pen/YRVvRe



As for the SCSS function that generates "restricted responsive spacings" classes (as i call them now), I did the following:



In the innerest loop, a new variable $next holds the map's next value.




  • If that value is not null, create the media query and the class with
    a "-only" suffix.

  • If the value is false, do nothing (because the
    regular inuitcss spacing classes cover that scenario already; I
    left the commented code here nevertheless, maybe it serves a
    purpose...):


The new function looks like this:



//scss
@if ($inuit-restricted-responsive-spacing-properties != null) {
@each $property-namespace, $property in $inuit-restricted-responsive-spacing-properties {
@each $direction-namespace, $direction-rules in $inuit-restricted-responsive-spacing-directions {
@each $size-namespace, $size in $inuit-restricted-responsive-spacing-sizes {
@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {

// Check, if the next breakpoint exists; if not, do not generate any classes.
// Add a '-only' suffix (could probably be made configurable via a variable...)
$next: map-get-next($mq-breakpoints, $inuit-bp-name, null);

@if ($next) {
@include mq($from: $inuit-bp-name, $until: map-get-next($mq-breakpoints, $inuit-bp-name, null)) {
.u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name}-only {
@each $direction in $direction-rules {
#{$property}#{$direction}: $size !important;
}
}
}
}

// Not necessary, because this os covered by the regular inuitcss classes already
// @else {
// @include mq($from: $inuit-bp-name) {
// .u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{$inuit-widths-breakpoint-separator}#{$inuit-bp-name} {
// @each $direction in $direction-rules {
// #{$property}#{$direction}: $size !important;
// }
// }
// }
// }
}
}
}
}


Thank you, ReSedano!







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 at 14:06









Robert Wildling

214211




214211












  • Well done, Robert! You did a great job! :-)
    – ReSedano
    Nov 15 at 21:51




















  • Well done, Robert! You did a great job! :-)
    – ReSedano
    Nov 15 at 21:51


















Well done, Robert! You did a great job! :-)
– ReSedano
Nov 15 at 21:51






Well done, Robert! You did a great job! :-)
– ReSedano
Nov 15 at 21:51




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248707%2fget-value-1-in-each-loop-with-multiple-values%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Coverage of Google Street View

Full-time equivalent

Surfing