-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
Supply a mixin to generate grid classes for quick prototyping #143
Comments
It may happen eventually, but it's not high on my priorities right now.
|
@ericam In the stack overflow link @timkelty posted, there is a mixin that you have written that produces grid classes. If I create a gird that has six columns, and use that mixin, I get classes such as the following: span2, span2-1, span2-3, span2-4, span-2-5, span2-6 I get the span1, span2 classes etc, but I don't understand the ones that are like span3-1, span2-1, etc Also from the mixin you posted is there anyway to streamline it, so it just outputs span-1, span-2, span-3 etc. Thanks for any help you can offer. |
You could streamline it any number of ways - they all just limit what you can do with it. If you remove context, you wont be able to create nested grids. You could also make sure the context is always larger than the span, as you say. I sometimes do have spans that break out of their context, but it's a bit of an edge case and removing it would cut down on bloat. // Change this:
@for $context from 1 through $total-columns {...}
// To this:
@for $context from 1 to $span {...} |
Thanks for your help! What I would really like to do is eliminate all the context classess (so I am just left with Span-1, Span-2, Span-3 etc); I have tried modifying the code to do this, but I can't quite get it to work. It just causes all the span classes to end up with 100% width:
Here is the CSS it produces:
In my code I have added a class override for device. |
Sorry, I can't make much sense of this. You need to eliminate the context loop entirely if you don't want context included. Here's the best I can figure out to make it work with different devices/media-queries: @mixin susy-classes($device, $silent: false) {
$base: if($silent, '%', '.');
$selector: '#{$base}span';
#{$base}container-#{$device} { @include container; }
%susy-span-base { @include span-columns(1); }
#{$base}span-full, #{$base}span-full-#{$device} { clear: both; width: 100% }
#{$base}omega-#{$device} { @include omega; }
@for $span from 1 to $total-columns {
#{$selector}-#{$span}-#{$device} {
@extend %susy-span-base;
width: columns($span);
}
}
}
@include at-breakpoint(4 30em) { @include susy-classes(mobile); }
@include at-breakpoint(30em 8 60em) { @include susy-classes(tablet); }
@include at-breakpoint(60em 12) { @include susy-classes(desktop); } But using it looks absolutely crazy to me. You really want to litter your markup with this shit? <div class="container-mobile container-tablet container-desktop">
<header class="span-full">header</header>
<div class="nav span-full-mobile span-3-tablet span-3-desktop">nav</div>
<div class="main span-full-mobile span-5-tablet omega-tablet span-9-desktop omega-desktop">main</div>
<footer class="span-full">footer</footer>
</div> Susy allows you to do the same layout with half the css and half the markup - why do this? |
(actually both mentions of |
+1 |
+1 Your nested output example is very nearly on the money for what I'm looking for out of this (Quick prototyping tools for people who just want to do unsemantic classes to knock something together quickly) - Is there an easy way to add 'last' to that example, so that we can make things fit on one line? |
I think I may have answered my own question - Is it as simple as just adding :) |
That's it :) |
Just giving my +1 here.
Having a susy-classes mixin in the core, like in the following example would be a time saver for me.
http://stackoverflow.com/questions/13544180/is-there-any-way-to-generate-grid-classes-for-use-directly-on-the-markup
The text was updated successfully, but these errors were encountered: