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

invalid Grid row margin #19

Closed
janwidmer opened this issue Aug 27, 2019 · 4 comments
Closed

invalid Grid row margin #19

janwidmer opened this issue Aug 27, 2019 · 4 comments

Comments

@janwidmer
Copy link

I am using the bootstrap-less-port with Webpack and Less version 3.10.1.

My custom grid setup looks like this:

@import "~bootstrap-less-port/less/_functions";
@import "~bootstrap-less-port/less/_variables";
@import "~bootstrap-less-port/less/mixins/_breakpoints";
@import "~bootstrap-less-port/less/mixins/_grid-framework";
@import "~bootstrap-less-port/less/mixins/_grid";

@import "~bootstrap-less-port/less/_grid";
@import "~bootstrap-less-port/less/utilities/_display";
@import "~bootstrap-less-port/less/utilities/_flex";

@grid-columns:                12;
@grid-gutter-width:          30px;

That works so far, but the generated css for the .row class looks like this:
image

It seems, that the problem is the - which is outside of the parenthesis in the file mixins/_grid.less in this code:

#make-row(@gutter: @grid-gutter-width) {
	display: flex;
	flex-wrap: wrap;
	margin-right: -(@gutter / 2);
	margin-left: -(@gutter / 2);
}

As soon as moving it inside the parenthesis, the calculation is done correctly during compiling of the less code.

Any idea, am I doing something wrong with my custom setup?

@seanCodes
Copy link
Owner

Can you verify that you’re compiling your Less with the math option set to always? (More info on the option here.)

always is supposed to be the default but I’d like to see what happens if you set it explicitly, just to rule it out as the cause.

@janwidmer
Copy link
Author

janwidmer commented Aug 27, 2019

Just figured it out the same time you answered :-)

My webpack less-loader had the option strictMath: true, set. Therefore it compiled the row styles like I described it above..

Would maybe be worth a hint that math values other than always could lead to unexpected behaviour..?

@seanCodes
Copy link
Owner

Glad to hear you got it figured out!

Yes, I'll update the readme and call that out as a requirement.

Did you set the strictMath option in the less-loader yourself or was the loader set up that way by default?

@janwidmer
Copy link
Author

ok cool..

I looked at the example here: https://github.com/webpack-contrib/less-loader#examples and did not question the strictMath parameter..

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

2 participants