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

`grid` and `grid-template` properties do not compile #2306

Open
while0pass opened this Issue Jun 7, 2017 · 5 comments

Comments

Projects
None yet
6 participants
@while0pass

while0pass commented Jun 7, 2017

This grid-template: [linename] 100px / [columnname1] 30% [columnname2] 70%; does not compile though it is not a syntax violation.

https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template
https://developer.mozilla.org/en-US/docs/Web/CSS/grid

@Panya

This comment has been minimized.

Member

Panya commented Jun 7, 2017

Yep, you can escape the [ and ] with \ as a temporary workaround:

grid-template: \[linename\] 100px / \[columnname1\] 30% \[columnname2\] 70%

@Panya Panya added the t: Bug label Jun 7, 2017

@justnorris

This comment has been minimized.

justnorris commented Aug 7, 2017

I found an alternative solution. Not elegant, but avoids backslashes all over the place. I hope that this gets fixed though...

b(val) // b for bracket
  unquote("[") + val + unquote("]")

.thing {
  grid-template: b(linename) 100px / b(col1) 30% b(col2) 70%
}
@abhayarawal

This comment has been minimized.

abhayarawal commented Aug 30, 2018

Is this fixed yet?

@Scriptura

This comment has been minimized.

Scriptura commented Oct 24, 2018

Is this fixed yet?

No. Always use anti-slash.

@MayBeTall

This comment has been minimized.

MayBeTall commented Nov 5, 2018

Here's a workaround I'm using for the issue:

grid-template-columns($value)
	if typeof($value) == 'string'
		grid-template-columns unquote($value)
	else
		grid-template-columns $value

This is just a function that overrides the parsing of the rule and allows you to use quotes around the value to have it parse correctly. It falls back to normal parsing if a string isn't given.

Example:

grid-template-columns "repeat(4, [col-start] 1fr [col-end] )"

Which is outputted as:

-ms-grid-columns: ([col-start] 1fr [col-end])[4];
grid-template-columns: repeat(4, [col-start] 1fr [col-end]);

Stylus browser compatibility seems to work fine with this method and should treat it as if you anti-slashed everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment