CSS Grid template formatting is broken when adding track size after line names
See original GitHub issueDescription
grid-template
gets formatted as one line when adding track sizes after line names
Input
The code looked like this before beautification:
.grid {
grid-template:
"top-bar top-bar" 100px
"left-bar center" 100px
}
Expected Output
The code should have looked like this after beautification:
.grid {
grid-template:
"top-bar top-bar" 100px
"left-bar center" 100px
}
Actual Output
The code actually looked like this after beautification:
.grid {
grid-template:
"top-bar top-bar"100px "left-bar center"100px
}
Steps to Reproduce
- create a selector with a
grid-template
declaration in it - add a value that contains line names and track sizes (as stated in the example above)
- format the document.
Also try it with a longer input:
grid-template:
"top-bar center center center center center top-bar" 100px
"left-bar center center center center center" 100px
/ 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px;
The result looks like this:
grid-template:
"top-bar center center center center center top-bar"100px "left-bar center center center center center"100px / 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px 10px;
Environment
OS: Windows
Settings
{
"indent_size": "4",
"indent_char": " ",
"max_preserve_newlines": "5",
"preserve_newlines": true,
"keep_array_indentation": false,
"break_chained_methods": false,
"indent_scripts": "normal",
"brace_style": "collapse",
"space_before_conditional": true,
"unescape_strings": false,
"jslint_happy": false,
"end_with_newline": false,
"wrap_line_length": "40",
"indent_inner_html": false,
"comma_first": false,
"e4x": false,
"indent_empty_lines": false
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:20
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Grid layout using named grid lines - CSS - MDN Web Docs
Line naming is incredibly useful, but some of the more baffling looking grid syntax comes from this combination of names and track sizes....
Read more >Understanding CSS Grid: Grid Template Areas
In a new series, Rachel Andrew breaks down the CSS Grid Layout ... An area is caused to span multiple tracks by repeating...
Read more >A Complete Guide to CSS Grid
<track-size> – can be a length, a percentage, or a fraction of the ... Defines a grid template by referencing the names of...
Read more >Grid Cheatsheet
Any rows/columns defined by grid-template-areas but not sized by ... a space-separated track list , the line names and track sizing functions of...
Read more >How to Create a Perfect CSS Grid on Your Website [Sample ...
The CSS grid layout (also referred to as "the grid") was proposed to the ... and grid-template-rows property with lines names and values....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@PeterShershov As I understand it, there are two problems here:
"top-bar top-bar" 100px
is getting remove. This needs to be fixed asap.grid-template:
is being changed to one line. This format will still work, but is not desirable. The should be fixed as well, but possibly later.As a short term work around, perhaps we could disable newline reformatting inside
grid-template:
… but that might be just as hard as fixing.Added PR for this issue 🙃