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

grid and grid-template properties do not compile #2306

Open
while0pass opened this issue Jun 7, 2017 · 6 comments
Open

grid and grid-template properties do not compile #2306

while0pass opened this issue Jun 7, 2017 · 6 comments
Labels

Comments

@while0pass
Copy link

@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
Copy link
Member

@Panya 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
@pyronaur
Copy link

@pyronaur pyronaur 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
Copy link

@abhayarawal abhayarawal commented Aug 30, 2018

Is this fixed yet?

@Scriptura
Copy link

@Scriptura Scriptura commented Oct 24, 2018

Is this fixed yet?

No. Always use anti-slash.

@eric-fraze
Copy link

@eric-fraze eric-fraze 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.

@GivenCui
Copy link

@GivenCui GivenCui commented Jun 28, 2019

Is this fixed yet?

.wrapper {
  display: grid;
  grid-template-columns: [col1-start] 1fr [col2-start] 1fr [col3-start] 1fr [cols-end];
  grid-template-rows: [row1-start] 100px [row2-start] 100px [rows-end];
}
.item {
  grid-column-start: col1-start;
  grid-column-end: col3-start;
  grid-row-start: row1-start;
  grid-row-end: rows-end;
}

throw error like this:

stylus:30:1
   26|   grid-column-end: col3-start;
   27|   grid-row-start: row1-start;
   28|   grid-row-end: rows-end;
   29| }
   30| 
-------^

Cannot read property 'clone' of undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants