In susy one it were pretty easy to define scopes where a element changed width depending on a global variable. I'm trying to learn Susy 2 but can not really get the point how it works with breakpoint integration.
I have made some psudocode here to point out what i want to archive
Susy SASS maps
$small: (
columns: 4,
);
$medium: (
columns: 18,
);
$large: (
columns: 24,
);
A html element
.foo {
span 2
at medium
span 6
at large
span 12
}
RESULT I WANT for .foo
- in small = 50% (minus some gutter)
- in medium = 33,3333% (minus some gutter)
- in large = 50% (minus some gutter)
How do you archive this? I've looked at several tutorials but they do not speak about this. This question talks about something similar. Is it possibly so that we have to constantly tell Susy which layout to use? We could of course say x **of** something
but i found it quite handy to just define the grids globally and skip the of all the time.
You can do this in Susy 2 almost exactly the way you did in Susy 1. The syntax is a bit more explicit, but the ideas are the same. Assuming you were using
at-breakpoint
in Susy 1, you'll usesusy-breakpoint
in Susy 2 [see the docs]:You can replace the
container()
arguments with your own breakpoints, as you like. I used the container function because that will mimic the way Susy 1 set breakpoints by default. It's a little less magic, a bit more explicit, and a lot more powerful. You now have the full power of Breakpoint available for defining your media-queries.