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
Implemented configurable number of columns #74
Conversation
dist/gridlex.css
Outdated
[class~="grid"] > [data-push-right*="off-3"], | ||
[class*="grid-"] > [data-push-right*="off-3"], | ||
[class*="grid_"] > [data-push-right*="off-3"] { | ||
margin-right: 25%; } | ||
|
||
[class~="grid"] > [data-push-left*="off-4"], |
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.
I have not look at all your work, but I see that offset are generated twice. Need to be fix before I decide to accept your great work :)
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.
I checked the diff of the CSS files again and it seems that it is not generated twice, but the order of rules between offset left and offset right is different if I put them in one for loop (as it is in this PR). If I seperate the loops as given below, the diff does not show any differences anymore. Would you like the loops to be seperate in order to have less differences?
// Function to generate the offset
@mixin makeOff($off)
{
[#{$gl-attributeName}~="#{$gl-gridName}"],
[#{$gl-attributeName}*="#{$gl-gridName}-"],
[#{$gl-attributeName}*="#{$gl-gridName}_"] {
@for $i from 0 through $gl-colCount - 1 {
> [data-push-left*="#{$off}-#{$i}"]{ margin-left: map-get($gl-colPortions, $i); }
}
}
[#{$gl-attributeName}~="#{$gl-gridName}"],
[#{$gl-attributeName}*="#{$gl-gridName}-"],
[#{$gl-attributeName}*="#{$gl-gridName}_"] {
@for $i from 0 through $gl-colCount - 1 {
> [data-push-right*="#{$off}-#{$i}"]{ margin-right: map-get($gl-colPortions, $i); }
}
}
}
fixed indentation
I just reworked the PR such that the diffs become slim and to be able to see that the offset rules are generated only once. |
Merge! |
I very much like how many features of flexbox gridlex embraces. In various projects I came across the need to have different proportions / number of columns which is why I converted the hard-coded blocks into
@for
loops and introduced a variable called$gl-colCount
which defaults to12
.The file
gridlex-preprocessing.scss
uses this variable to calculate the column proportions and fractions which is then used ingridlex-mixins.scss
to generate the needed column and grid definitions.I though I'd try to give this back for all the time I saved by not having to create a grid system by myself. Maybe you find it useful as well and would be willing to merge this PR.
In any case: Thanks for gridlex!